about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/imports.rs4
-rw-r--r--src/reorder.rs17
2 files changed, 18 insertions, 3 deletions
diff --git a/src/imports.rs b/src/imports.rs
index 0fa6dec2265..a87d100ca9b 100644
--- a/src/imports.rs
+++ b/src/imports.rs
@@ -7,7 +7,7 @@ use syntax::source_map::{self, BytePos, Span, DUMMY_SP};
 
 use crate::comment::combine_strs_with_missing_comments;
 use crate::config::lists::*;
-use crate::config::{Edition, IndentStyle, Version};
+use crate::config::{Edition, IndentStyle};
 use crate::lists::{
     definitive_tactic, itemize_list, write_list, ListFormatting, ListItem, Separator,
 };
@@ -250,7 +250,7 @@ impl UseTree {
             let hi = self.span.lo();
             let span = mk_sp(lo, hi);
 
-            let allow_extend = if context.config.version() == Version::Two {
+            let allow_extend = if attrs.len() == 1 {
                 let line_len = attr_str.len() + 1 + use_str.len();
                 !attrs.first().unwrap().is_sugared_doc
                     && context.config.inline_attribute_width() >= line_len
diff --git a/src/reorder.rs b/src/reorder.rs
index 40f6f07c8dc..e206d9249e7 100644
--- a/src/reorder.rs
+++ b/src/reorder.rs
@@ -83,7 +83,22 @@ fn rewrite_reorderable_item(
         _ => return None,
     };
 
-    combine_strs_with_missing_comments(context, &attrs_str, &item_str, missed_span, shape, false)
+    let allow_extend = if attrs.len() == 1 {
+        let line_len = attrs_str.len() + 1 + item_str.len();
+        !attrs.first().unwrap().is_sugared_doc
+            && context.config.inline_attribute_width() >= line_len
+    } else {
+        false
+    };
+
+    combine_strs_with_missing_comments(
+        context,
+        &attrs_str,
+        &item_str,
+        missed_span,
+        shape,
+        allow_extend,
+    )
 }
 
 /// Rewrite a list of items with reordering. Every item in `items` must have