Skip to content

Commit

Permalink
Delete test_leftmost_rightmost_invariant
Browse files Browse the repository at this point in the history
For an upcoming more-complicated FixupContext this test is no longer
useful.
  • Loading branch information
dtolnay committed Jan 1, 2025
1 parent 98a39cc commit 4b1cf00
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions src/fixup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::classify;
use crate::expr::Expr;
use crate::precedence::Precedence;

#[cfg_attr(test, derive(PartialEq, Debug))]
pub(crate) struct FixupContext {
// Print expression such that it can be parsed back as a statement
// consisting of the original expression.
Expand Down Expand Up @@ -355,41 +354,3 @@ impl Clone for FixupContext {
*self
}
}

#[cfg(feature = "full")]
#[test]
fn test_leftmost_rightmost_invariant() {
const BITS: usize = 9;

for bits in 0u16..1 << BITS {
let mut i = 0;
let mut bit = || {
let mask = 1 << i;
i += 1;
(bits & mask) != 0
};
let fixup = FixupContext {
stmt: bit(),
leftmost_subexpression_in_stmt: bit(),
match_arm: bit(),
leftmost_subexpression_in_match_arm: bit(),
rightmost_subexpression: bit(),
parenthesize_exterior_struct_lit: bit(),
next_operator_can_begin_expr: bit(),
next_operator_can_continue_expr: bit(),
next_operator_can_begin_generics: bit(),
};
assert_eq!(i, BITS);
assert_eq!(
fixup
.leftmost_subexpression_with_operator(false, false)
.rightmost_subexpression(),
FixupContext {
rightmost_subexpression: true,
..fixup
.rightmost_subexpression()
.leftmost_subexpression_with_operator(false, false)
},
);
}
}

0 comments on commit 4b1cf00

Please sign in to comment.