Don't repeat AssertParamIs{Clone,Eq}
assertions.
It's common to see repeated assertions like this in derived `clone` and `eq` methods: ``` let _: ::core::clone::AssertParamIsClone<u32>; let _: ::core::clone::AssertParamIsClone<u32>; ``` This commit avoids them.
This commit is contained in:
parent
5762d2385e
commit
a7b1d31a9f
4 changed files with 43 additions and 29 deletions
|
@ -2036,6 +2036,14 @@ impl TyKind {
|
|||
pub fn is_unit(&self) -> bool {
|
||||
matches!(self, TyKind::Tup(tys) if tys.is_empty())
|
||||
}
|
||||
|
||||
pub fn is_simple_path(&self) -> Option<Symbol> {
|
||||
if let TyKind::Path(None, Path { segments, .. }) = &self && segments.len() == 1 {
|
||||
Some(segments[0].ident.name)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Syntax used to declare a trait object.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue