From 919b3913150e8cce662e03891efeafdde038b383 Mon Sep 17 00:00:00 2001 From: jyn Date: Sat, 22 Apr 2023 11:56:41 -0500 Subject: [PATCH] Decrease the indentation in `imported_source_file` --- compiler/rustc_metadata/src/rmeta/decoder.rs | 23 +++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index c9ab07f5f27..5884b052eab 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -1467,19 +1467,16 @@ fn filter<'a>(sess: &Session, path: Option<&'a Path>) -> Option<&'a Path> { // `try_to_translate_virtual_to_real` don't have to worry about how the // compiler is bootstrapped. if let Some(virtual_dir) = &sess.opts.unstable_opts.simulate_remapped_rust_src_base - { - if let Some(real_dir) = &sess.opts.real_rust_source_base_dir { - for subdir in ["library", "compiler"] { - if let rustc_span::FileName::Real(ref mut old_name) = name { - if let rustc_span::RealFileName::LocalPath(local) = old_name { - if let Ok(rest) = local.strip_prefix(real_dir.join(subdir)) { - *old_name = rustc_span::RealFileName::Remapped { - local_path: None, - virtual_name: virtual_dir.join(subdir).join(rest), - }; - } - } - } + && let Some(real_dir) = &sess.opts.real_rust_source_base_dir + && let rustc_span::FileName::Real(ref mut old_name) = name + && let rustc_span::RealFileName::LocalPath(local) = old_name { + for subdir in ["library", "compiler"] { + if let Ok(rest) = local.strip_prefix(real_dir.join(subdir)) { + *old_name = rustc_span::RealFileName::Remapped { + local_path: None, + virtual_name: virtual_dir.join(subdir).join(rest), + }; + break; } } }