mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-18 18:53:04 +00:00
Fix long field accesses not being broken onto separate lines
Fixes #512
This commit is contained in:
parent
bdc2e4fd3f
commit
465662a691
@ -194,8 +194,22 @@ fn rewrite_chain_expr(expr: &ast::Expr,
|
||||
width,
|
||||
offset)
|
||||
}
|
||||
ast::Expr_::ExprField(_, ref field) => Some(format!(".{}", field.node)),
|
||||
ast::Expr_::ExprTupField(_, ref field) => Some(format!(".{}", field.node)),
|
||||
ast::Expr_::ExprField(_, ref field) => {
|
||||
let s = format!(".{}", field.node);
|
||||
if s.len() <= width {
|
||||
Some(s)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
ast::Expr_::ExprTupField(_, ref field) => {
|
||||
let s = format!(".{}", field.node);
|
||||
if s.len() <= width {
|
||||
Some(s)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
3
tests/source/long_field_access.rs
Normal file
3
tests/source/long_field_access.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn f() {
|
||||
block_flow.base.stacking_relative_position_of_display_port = self.base.stacking_relative_position_of_display_port;
|
||||
}
|
4
tests/target/long_field_access.rs
Normal file
4
tests/target/long_field_access.rs
Normal file
@ -0,0 +1,4 @@
|
||||
fn f() {
|
||||
block_flow.base.stacking_relative_position_of_display_port =
|
||||
self.base.stacking_relative_position_of_display_port;
|
||||
}
|
Loading…
Reference in New Issue
Block a user