mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
* Use `Indent::block_indent` instead of adding `config.tab_spaces` * Fix #1259 impl block closing brace placement
This commit is contained in:
parent
90db34a961
commit
1358f1ac80
@ -539,6 +539,7 @@ pub fn format_impl(context: &RewriteContext, item: &ast::Item, offset: Indent) -
|
||||
|
||||
if result.chars().last().unwrap() == '{' {
|
||||
result.push('\n');
|
||||
result.push_str(&offset.to_string(context.config));
|
||||
}
|
||||
result.push('}');
|
||||
|
||||
@ -698,8 +699,7 @@ pub fn format_trait(context: &RewriteContext, item: &ast::Item, offset: Indent)
|
||||
if offset.width() + last_line_width(&result) + trait_bound_str.len() >
|
||||
context.config.ideal_width {
|
||||
result.push('\n');
|
||||
let width = context.block_indent.width() + context.config.tab_spaces;
|
||||
let trait_indent = Indent::new(0, width);
|
||||
let trait_indent = context.block_indent.block_indent(context.config);
|
||||
result.push_str(&trait_indent.to_string(context.config));
|
||||
}
|
||||
result.push_str(&trait_bound_str);
|
||||
|
@ -103,3 +103,11 @@ impl<BorrowType, K, V, NodeType, HandleType> Handle<NodeRef<BorrowType, K, V, No
|
||||
|
||||
impl<BorrowType, K, V, NodeType, HandleType> PartialEq for Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType> {
|
||||
}
|
||||
|
||||
mod x {
|
||||
impl<A, B, C, D> Foo
|
||||
where A: 'static,
|
||||
B: 'static,
|
||||
C: 'static,
|
||||
D: 'static { }
|
||||
}
|
||||
|
@ -132,3 +132,13 @@ impl<BorrowType, K, V, NodeType, HandleType> Handle<NodeRef<BorrowType, K, V, No
|
||||
impl<BorrowType, K, V, NodeType, HandleType> PartialEq
|
||||
for Handle<NodeRef<BorrowType, K, V, NodeType>, HandleType> {
|
||||
}
|
||||
|
||||
mod x {
|
||||
impl<A, B, C, D> Foo
|
||||
where A: 'static,
|
||||
B: 'static,
|
||||
C: 'static,
|
||||
D: 'static
|
||||
{
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user