Ensure space after binary exprs that ends with .
before range expr
Removing the space would lead to compilation errors.
This commit is contained in:
parent
35c1b7d734
commit
73c81495cd
@ -282,6 +282,9 @@ pub(crate) fn format_expr(
|
||||
match lhs.kind {
|
||||
ast::ExprKind::Lit(token_lit) => lit_ends_in_dot(&token_lit),
|
||||
ast::ExprKind::Unary(_, ref expr) => needs_space_before_range(context, expr),
|
||||
ast::ExprKind::Binary(_, _, ref rhs_expr) => {
|
||||
needs_space_before_range(context, rhs_expr)
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
3
tests/source/issue-6059/repro.rs
Normal file
3
tests/source/issue-6059/repro.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn float_range_tests() {
|
||||
self.coords.x -= rng.gen_range(-self.radius / 2. .. self.radius / 2.);
|
||||
}
|
6
tests/target/issue-6059/additional.rs
Normal file
6
tests/target/issue-6059/additional.rs
Normal file
@ -0,0 +1,6 @@
|
||||
fn float_range_tests() {
|
||||
let _range = 3. / 2. ..4.;
|
||||
let _range = 3.0 / 2. ..4.0;
|
||||
let _range = 3.0 / 2.0..4.0;
|
||||
let _range = 3. / 2.0..4.0;
|
||||
}
|
3
tests/target/issue-6059/repro.rs
Normal file
3
tests/target/issue-6059/repro.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn float_range_tests() {
|
||||
self.coords.x -= rng.gen_range(-self.radius / 2. ..self.radius / 2.);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user