mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 13:05:18 +03:00
apply inline_attribute_width for extern crate
This commit is contained in:
+2
-2
@@ -7,7 +7,7 @@
|
||||
|
||||
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 @@ pub fn rewrite_top_level(&self, context: &RewriteContext<'_>, shape: Shape) -> O
|
||||
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
|
||||
|
||||
+16
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user