Skip to content

Commit d5674a3

Browse files
MarcusGrassytmimi
authored andcommitted
Fix bug checking wrong side of binary expression, add more test cases
1 parent e8ac06d commit d5674a3

File tree

6 files changed

+14
-8
lines changed

6 files changed

+14
-8
lines changed

src/expr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ pub(crate) fn format_expr(
282282
match lhs.kind {
283283
ast::ExprKind::Lit(token_lit) => lit_ends_in_dot(&token_lit),
284284
ast::ExprKind::Unary(_, ref expr) => needs_space_before_range(context, expr),
285-
ast::ExprKind::Binary(_, ref expr, _) => {
286-
needs_space_before_range(context, expr)
285+
ast::ExprKind::Binary(_, _, ref rhs_expr) => {
286+
needs_space_before_range(context, rhs_expr)
287287
}
288288
_ => false,
289289
}

tests/source/issue-6059/repro.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn float_range_tests() {
2+
self.coords.x -= rng.gen_range(-self.radius / 2. .. self.radius / 2.);
3+
}

tests/target/issue-6059/additional.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fn float_range_tests() {
2+
let _range = 3. / 2. ..4.;
3+
let _range = 3.0 / 2. ..4.0;
4+
let _range = 3.0 / 2.0..4.0;
5+
let _range = 3. / 2.0..4.0;
6+
}

tests/target/issue-6059/no_trailing_dot.rs

-3
This file was deleted.

tests/target/issue-6059/repro.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn float_range_tests() {
2+
self.coords.x -= rng.gen_range(-self.radius / 2. ..self.radius / 2.);
3+
}

tests/target/issue-6059/trailing_dot.rs

-3
This file was deleted.

0 commit comments

Comments
 (0)