Fixed overly complicated code as requested in the code review

This commit is contained in:
crw5996 2018-08-27 23:08:37 -04:00
parent d832525809
commit 18cd0c4986

View file

@ -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);