mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Use let chains in pretty_printing_compatibility_hack
.
To reduce indentation and improve readability.
This commit is contained in:
parent
d6d2ff055e
commit
3607cee3e7
@ -1338,13 +1338,12 @@ pub fn parse_macro_name_and_helper_attrs(
|
||||
/// FIXME(#73933): Remove this eventually.
|
||||
fn pretty_printing_compatibility_hack(item: &Item, sess: &Session) -> bool {
|
||||
let name = item.ident.name;
|
||||
if name == sym::ProceduralMasqueradeDummyType {
|
||||
if let ast::ItemKind::Enum(enum_def, _) = &item.kind {
|
||||
if let [variant] = &*enum_def.variants {
|
||||
if variant.ident.name == sym::Input {
|
||||
let filename = sess.source_map().span_to_filename(item.ident.span);
|
||||
if let FileName::Real(real) = filename {
|
||||
if let Some(c) = real
|
||||
if name == sym::ProceduralMasqueradeDummyType
|
||||
&& let ast::ItemKind::Enum(enum_def, _) = &item.kind
|
||||
&& let [variant] = &*enum_def.variants
|
||||
&& variant.ident.name == sym::Input
|
||||
&& let FileName::Real(real) = sess.source_map().span_to_filename(item.ident.span)
|
||||
&& let Some(c) = real
|
||||
.local_path()
|
||||
.unwrap_or(Path::new(""))
|
||||
.components()
|
||||
@ -1357,10 +1356,7 @@ fn pretty_printing_compatibility_hack(item: &Item, sess: &Session) -> bool {
|
||||
let mut version = c.trim_start_matches("rental-").split('.');
|
||||
version.next() == Some("0")
|
||||
&& version.next() == Some("5")
|
||||
&& version
|
||||
.next()
|
||||
.and_then(|c| c.parse::<u32>().ok())
|
||||
.is_some_and(|v| v < 6)
|
||||
&& version.next().and_then(|c| c.parse::<u32>().ok()).is_some_and(|v| v < 6)
|
||||
};
|
||||
|
||||
if crate_matches {
|
||||
@ -1376,11 +1372,6 @@ fn pretty_printing_compatibility_hack(item: &Item, sess: &Session) -> bool {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user