TIL what `wether` means.
This commit is contained in:
mcarton
2016-08-23 19:51:12 +02:00
parent 8bab4ed1c5
commit be329ebdf7

View File

@@ -201,7 +201,7 @@ impl<'a> std::ops::Not for Sugg<'a> {
/// Helper type to display either `foo` or `(foo)`. /// Helper type to display either `foo` or `(foo)`.
struct ParenHelper<T> { struct ParenHelper<T> {
/// Wether parenthesis are needed. /// Whether parenthesis are needed.
paren: bool, paren: bool,
/// The main thing to display. /// The main thing to display.
wrapped: T, wrapped: T,
@@ -240,17 +240,17 @@ pub fn make_unop(op: &str, expr: Sugg) -> Sugg<'static> {
/// Precedence of shift operator relative to other arithmetic operation is often confusing so /// Precedence of shift operator relative to other arithmetic operation is often confusing so
/// parenthesis will always be added for a mix of these. /// parenthesis will always be added for a mix of these.
pub fn make_assoc(op: AssocOp, lhs: &Sugg, rhs: &Sugg) -> Sugg<'static> { pub fn make_assoc(op: AssocOp, lhs: &Sugg, rhs: &Sugg) -> Sugg<'static> {
/// Wether the operator is a shift operator `<<` or `>>`. /// Whether the operator is a shift operator `<<` or `>>`.
fn is_shift(op: &AssocOp) -> bool { fn is_shift(op: &AssocOp) -> bool {
matches!(*op, AssocOp::ShiftLeft | AssocOp::ShiftRight) matches!(*op, AssocOp::ShiftLeft | AssocOp::ShiftRight)
} }
/// Wether the operator is a arithmetic operator (`+`, `-`, `*`, `/`, `%`). /// Whether the operator is a arithmetic operator (`+`, `-`, `*`, `/`, `%`).
fn is_arith(op: &AssocOp) -> bool { fn is_arith(op: &AssocOp) -> bool {
matches!(*op, AssocOp::Add | AssocOp::Subtract | AssocOp::Multiply | AssocOp::Divide | AssocOp::Modulus) matches!(*op, AssocOp::Add | AssocOp::Subtract | AssocOp::Multiply | AssocOp::Divide | AssocOp::Modulus)
} }
/// Wether the operator `op` needs parenthesis with the operator `other` in the direction /// Whether the operator `op` needs parenthesis with the operator `other` in the direction
/// `dir`. /// `dir`.
fn needs_paren(op: &AssocOp, other: &AssocOp, dir: Associativity) -> bool { fn needs_paren(op: &AssocOp, other: &AssocOp, dir: Associativity) -> bool {
other.precedence() < op.precedence() || other.precedence() < op.precedence() ||