Attempt to format attributes if only they exist
@@ -242,7 +242,8 @@ impl UseTree {
format!("{}use {};", vis, s)
}
})?;
- if let Some(ref attrs) = self.attrs {
+ match self.attrs {
+ Some(ref attrs) if !attrs.is_empty() => {
let attr_str = attrs.rewrite(context, shape)?;
let lo = attrs.last().as_ref()?.span().hi();
let hi = self.span.lo();
@@ -264,8 +265,8 @@ impl UseTree {
shape,
allow_extend,
)
- } else {
- Some(use_str)
+ }
+ _ => Some(use_str),
}
}
