From 18cd0c4986b2f262c6dedf193b3b36c2d0b7028d Mon Sep 17 00:00:00 2001 From: crw5996 Date: Mon, 27 Aug 2018 23:08:37 -0400 Subject: [PATCH] Fixed overly complicated code as requested in the code review --- src/imports.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/imports.rs b/src/imports.rs index 4aee67759c1f..db00c45b9d93 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -318,15 +318,10 @@ impl UseTree { attrs, }; - let leading_modsep = if context.config.edition() == Edition::Edition2018 { - if a.prefix.to_string().len() > 2 && a.prefix.to_string().starts_with("::") { - true - } else { - false - } - } else { - false - }; + let leading_modsep = context.config.edition() == Edition::Edition2018 + && a.prefix.to_string().len() > 2 + && a.prefix.to_string().starts_with("::"); + for p in &a.prefix.segments { if let Some(use_segment) = UseSegment::from_path_segment(context, p, leading_modsep) { result.path.push(use_segment);