Auto merge of #98758 - nnethercote:more-derive-output-improvements, r=Mark-Simulacrum
More derive output improvements This PR includes: - Some test improvements. - Some cosmetic changes to derive output that make the code look more like what a human would write. - Some more fundamental improvements to `cmp` and `partial_cmp` generation. r? `@Mark-Simulacrum`
This commit is contained in:
commit
fbdb07f4e7
15 changed files with 655 additions and 568 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