pub enum CloneKind {
Exact,
Renamed,
Similar,
Semantic,
}Expand description
How the two fragments of a clone relate at the token level (issue #998).
Variants§
Exact
The fragments are token-for-token identical.
Renamed
The fragments match only after identifier, literal or annotation
normalization (--ignore-identifiers, --ignore-literals,
--ignore-annotations): a Type-2 clone.
Similar
A Type-3 near-miss clone: two or more matches of the same file pair
merged across a gap of unmatched lines (--max-gap-lines), or a pair
of structurally similar functions (--similarity). similar takes
precedence over renamed: a merge of renamed halves is similar.
Semantic
A Type-4 clone (--semantic, experimental): two functions that do the
same thing written differently, possibly in different languages, found
by comparing embeddings of their code. similarity is the cosine
similarity of the two embeddings.
Implementations§
Source§impl CloneKind
impl CloneKind
pub fn is_renamed(self) -> bool
pub fn is_similar(self) -> bool
pub fn is_semantic(self) -> bool
pub fn as_str(self) -> &'static str
Trait Implementations§
impl Copy for CloneKind
Source§impl<'de> Deserialize<'de> for CloneKind
impl<'de> Deserialize<'de> for CloneKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for CloneKind
impl StructuralPartialEq for CloneKind
Auto Trait Implementations§
impl Freeze for CloneKind
impl RefUnwindSafe for CloneKind
impl Send for CloneKind
impl Sync for CloneKind
impl Unpin for CloneKind
impl UnsafeUnpin for CloneKind
impl UnwindSafe for CloneKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more