Take attributes_on_same_line_as_field into account
This commit is contained in:
parent
59d1e84259
commit
467b7b5a6c
@ -265,7 +265,7 @@ where
|
||||
// Now that we know how we will layout, we can decide for sure if there
|
||||
// will be a trailing separator.
|
||||
let mut trailing_separator = formatting.needs_trailing_separator();
|
||||
let mut result = String::new();
|
||||
let mut result = String::with_capacity(128);
|
||||
let cloned_items = items.clone();
|
||||
let mut iter = items.into_iter().enumerate().peekable();
|
||||
let mut item_max_width: Option<usize> = None;
|
||||
|
@ -53,6 +53,8 @@ impl AlignedItem for ast::StructField {
|
||||
} else {
|
||||
mk_sp(self.attrs.last().unwrap().span.hi(), self.span.lo())
|
||||
};
|
||||
let attrs_extendable = context.config.attributes_on_same_line_as_field() &&
|
||||
is_attributes_extendable(&attrs_str);
|
||||
rewrite_struct_field_prefix(context, self).and_then(|field_str| {
|
||||
combine_strs_with_missing_comments(
|
||||
context,
|
||||
@ -60,7 +62,7 @@ impl AlignedItem for ast::StructField {
|
||||
&field_str,
|
||||
missing_span,
|
||||
shape,
|
||||
is_attributes_extendable(&attrs_str),
|
||||
attrs_extendable,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
@ -9,3 +9,9 @@ struct Lorem {
|
||||
#[ serde(rename = "Amet") ]
|
||||
amet: usize,
|
||||
}
|
||||
|
||||
// #1943
|
||||
pub struct Bzip2 {
|
||||
# [ serde (rename = "level") ]
|
||||
level: i32 ,
|
||||
}
|
||||
|
@ -9,3 +9,9 @@ struct Lorem {
|
||||
#[serde(rename = "Amet")]
|
||||
amet: usize,
|
||||
}
|
||||
|
||||
// #1943
|
||||
pub struct Bzip2 {
|
||||
#[serde(rename = "level")]
|
||||
level: i32,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user