Don't complete already used derive attributes
This commit is contained in:
parent
8f936c5571
commit
a92ed1eef4
@ -31,6 +31,8 @@ pub(super) fn complete_derive(
|
|||||||
let lookup = components.join(", ");
|
let lookup = components.join(", ");
|
||||||
let label = components.iter().rev().join(", ");
|
let label = components.iter().rev().join(", ");
|
||||||
(label, Some(lookup))
|
(label, Some(lookup))
|
||||||
|
} else if existing_derives.contains(&derive) {
|
||||||
|
continue;
|
||||||
} else {
|
} else {
|
||||||
(derive, None)
|
(derive, None)
|
||||||
};
|
};
|
||||||
@ -139,16 +141,15 @@ pub macro Ord {}
|
|||||||
check(
|
check(
|
||||||
r#"#[derive(serde::Serialize, PartialEq, $0)] struct Test;"#,
|
r#"#[derive(serde::Serialize, PartialEq, $0)] struct Test;"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
at PartialEq
|
at Default
|
||||||
at Default
|
at Eq
|
||||||
at Eq
|
at Eq, PartialOrd, Ord
|
||||||
at Eq, PartialOrd, Ord
|
at Clone, Copy
|
||||||
at Clone, Copy
|
at Debug
|
||||||
at Debug
|
at Clone
|
||||||
at Clone
|
at Hash
|
||||||
at Hash
|
at PartialOrd
|
||||||
at PartialOrd
|
"#]],
|
||||||
"#]],
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,16 +158,15 @@ pub macro Ord {}
|
|||||||
check(
|
check(
|
||||||
r#"#[derive($0 serde::Serialize, PartialEq)] struct Test;"#,
|
r#"#[derive($0 serde::Serialize, PartialEq)] struct Test;"#,
|
||||||
expect![[r#"
|
expect![[r#"
|
||||||
at PartialEq
|
at Default
|
||||||
at Default
|
at Eq
|
||||||
at Eq
|
at Eq, PartialOrd, Ord
|
||||||
at Eq, PartialOrd, Ord
|
at Clone, Copy
|
||||||
at Clone, Copy
|
at Debug
|
||||||
at Debug
|
at Clone
|
||||||
at Clone
|
at Hash
|
||||||
at Hash
|
at PartialOrd
|
||||||
at PartialOrd
|
"#]],
|
||||||
"#]],
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user