Fixed overly complicated code as requested in the code review
This commit is contained in:
parent
d832525809
commit
18cd0c4986
1 changed files with 4 additions and 9 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue