mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-04 01:42:54 +03:00
Don't put a newline before ? when it is the second sub-expression in a chain (#1012)
Fixes #1003
This commit is contained in:
committed by
Marcus Klaas de Vries
parent
775de8a62b
commit
d6bcfceb7e
+3
-1
@@ -179,7 +179,9 @@ pub fn rewrite_chain(expr: &ast::Expr,
|
||||
format!("\n{}", indent.to_string(context.config))
|
||||
};
|
||||
|
||||
let first_connector = if extend {
|
||||
let first_connector = if extend || subexpr_list.len() == 0 {
|
||||
""
|
||||
} else if let ast::ExprKind::Try(_) = subexpr_list[0].node {
|
||||
""
|
||||
} else {
|
||||
&*connector
|
||||
|
||||
@@ -124,4 +124,12 @@ fn try_shorthand() {
|
||||
let y = a.very .loooooooooooooooooooooooooooooooooooooong() .chain()
|
||||
.inside() .weeeeeeeeeeeeeee()? .test() .0
|
||||
.x;
|
||||
|
||||
parameterized(f,
|
||||
substs,
|
||||
def_id,
|
||||
Ns::Value,
|
||||
&[],
|
||||
|tcx| tcx.lookup_item_type(def_id).generics)?;
|
||||
fooooooooooooooooooooooooooo()?.bar()?.baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz()?;
|
||||
}
|
||||
|
||||
@@ -151,4 +151,14 @@ fn try_shorthand() {
|
||||
.test()
|
||||
.0
|
||||
.x;
|
||||
|
||||
parameterized(f,
|
||||
substs,
|
||||
def_id,
|
||||
Ns::Value,
|
||||
&[],
|
||||
|tcx| tcx.lookup_item_type(def_id).generics)?;
|
||||
fooooooooooooooooooooooooooo()?
|
||||
.bar()?
|
||||
.baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz()?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user