Fix a bug with nested impls
This commit is contained in:
parent
5a3f5bc1f6
commit
d405fdc236
3 changed files with 43 additions and 4 deletions
|
|
@ -506,10 +506,6 @@ pub fn format_impl(context: &RewriteContext, item: &ast::Item, offset: Indent) -
|
|||
result.push('{');
|
||||
|
||||
if !items.is_empty() {
|
||||
result.push('\n');
|
||||
let indent_str = context.block_indent.to_string(context.config);
|
||||
result.push_str(&indent_str);
|
||||
|
||||
let mut visitor = FmtVisitor::from_codemap(context.parse_session, context.config, None);
|
||||
visitor.block_indent = context.block_indent.block_indent(context.config);
|
||||
|
||||
|
|
@ -521,8 +517,11 @@ pub fn format_impl(context: &RewriteContext, item: &ast::Item, offset: Indent) -
|
|||
visitor.visit_impl_item(&item);
|
||||
}
|
||||
|
||||
result.push('\n');
|
||||
result.push_str(trim_newlines(&visitor.buffer.to_string()));
|
||||
result.push('\n');
|
||||
|
||||
let indent_str = context.block_indent.to_string(context.config);
|
||||
result.push_str(&indent_str);
|
||||
}
|
||||
result.push('}');
|
||||
|
|
|
|||
|
|
@ -21,3 +21,23 @@ impl<'a, 'b, X, Y: Foo<Bar>> Foo<'a, X> for Bar<'b, Y> where X: Fooooooooooooooo
|
|||
{
|
||||
fn foo() { "hi" }
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
fn foo() {}
|
||||
}
|
||||
|
||||
mod a {
|
||||
impl Foo {
|
||||
// Hello!
|
||||
fn foo() {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mod b {
|
||||
mod a {
|
||||
impl Foo {
|
||||
fn foo() {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,3 +36,23 @@ impl<'a, 'b, X, Y: Foo<Bar>> Foo<'a, X> for Bar<'b, Y> where X: Fooooooooooooooo
|
|||
"hi"
|
||||
}
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
fn foo() {}
|
||||
}
|
||||
|
||||
mod a {
|
||||
impl Foo {
|
||||
// Hello!
|
||||
fn foo() {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mod b {
|
||||
mod a {
|
||||
impl Foo {
|
||||
fn foo() {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue