diff --git a/src/items.rs b/src/items.rs index 665704ea20f..dafb7095002 100644 --- a/src/items.rs +++ b/src/items.rs @@ -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); diff --git a/tests/source/impls.rs b/tests/source/impls.rs index 6d65b8b4a7a..978ac8cc313 100644 --- a/tests/source/impls.rs +++ b/tests/source/impls.rs @@ -103,3 +103,11 @@ impl Handle PartialEq for Handle, HandleType> { } + +mod x { + impl Foo + where A: 'static, + B: 'static, + C: 'static, + D: 'static { } +} diff --git a/tests/target/impls.rs b/tests/target/impls.rs index 87791d25648..dee683d18b1 100644 --- a/tests/target/impls.rs +++ b/tests/target/impls.rs @@ -132,3 +132,13 @@ impl Handle PartialEq for Handle, HandleType> { } + +mod x { + impl Foo + where A: 'static, + B: 'static, + C: 'static, + D: 'static + { + } +}