@@ -325,22 +325,22 @@ pub fn make_unop(op: &str, expr: Sugg<'_>) -> Sugg<'static> {
325
325
/// parenthesis will always be added for a mix of these.
326
326
pub fn make_assoc ( op : AssocOp , lhs : & Sugg < ' _ > , rhs : & Sugg < ' _ > ) -> Sugg < ' static > {
327
327
/// Returns `true` if the operator is a shift operator `<<` or `>>`.
328
- fn is_shift ( op : & AssocOp ) -> bool {
329
- matches ! ( * op, AssocOp :: ShiftLeft | AssocOp :: ShiftRight )
328
+ fn is_shift ( op : AssocOp ) -> bool {
329
+ matches ! ( op, AssocOp :: ShiftLeft | AssocOp :: ShiftRight )
330
330
}
331
331
332
332
/// Returns `true` if the operator is a arithmetic operator
333
333
/// (i.e., `+`, `-`, `*`, `/`, `%`).
334
- fn is_arith ( op : & AssocOp ) -> bool {
334
+ fn is_arith ( op : AssocOp ) -> bool {
335
335
matches ! (
336
- * op,
336
+ op,
337
337
AssocOp :: Add | AssocOp :: Subtract | AssocOp :: Multiply | AssocOp :: Divide | AssocOp :: Modulus
338
338
)
339
339
}
340
340
341
341
/// Returns `true` if the operator `op` needs parenthesis with the operator
342
342
/// `other` in the direction `dir`.
343
- fn needs_paren ( op : & AssocOp , other : & AssocOp , dir : Associativity ) -> bool {
343
+ fn needs_paren ( op : AssocOp , other : AssocOp , dir : Associativity ) -> bool {
344
344
other. precedence ( ) < op. precedence ( )
345
345
|| ( other. precedence ( ) == op. precedence ( )
346
346
&& ( ( op != other && associativity ( op) != dir)
@@ -349,14 +349,14 @@ pub fn make_assoc(op: AssocOp, lhs: &Sugg<'_>, rhs: &Sugg<'_>) -> Sugg<'static>
349
349
|| is_shift ( other) && is_arith ( op)
350
350
}
351
351
352
- let lhs_paren = if let Sugg :: BinOp ( ref lop, _) = * lhs {
353
- needs_paren ( & op, lop, Associativity :: Left )
352
+ let lhs_paren = if let Sugg :: BinOp ( lop, _) = * lhs {
353
+ needs_paren ( op, lop, Associativity :: Left )
354
354
} else {
355
355
false
356
356
} ;
357
357
358
- let rhs_paren = if let Sugg :: BinOp ( ref rop, _) = * rhs {
359
- needs_paren ( & op, rop, Associativity :: Right )
358
+ let rhs_paren = if let Sugg :: BinOp ( rop, _) = * rhs {
359
+ needs_paren ( op, rop, Associativity :: Right )
360
360
} else {
361
361
false
362
362
} ;
@@ -424,13 +424,13 @@ enum Associativity {
424
424
/// they are considered
425
425
/// associative.
426
426
#[ must_use]
427
- fn associativity ( op : & AssocOp ) -> Associativity {
427
+ fn associativity ( op : AssocOp ) -> Associativity {
428
428
use rustc_ast:: util:: parser:: AssocOp :: {
429
429
Add , As , Assign , AssignOp , BitAnd , BitOr , BitXor , Colon , Divide , DotDot , DotDotEq , Equal , Greater ,
430
430
GreaterEqual , LAnd , LOr , Less , LessEqual , Modulus , Multiply , NotEqual , ShiftLeft , ShiftRight , Subtract ,
431
431
} ;
432
432
433
- match * op {
433
+ match op {
434
434
Assign | AssignOp ( _) => Associativity :: Right ,
435
435
Add | BitAnd | BitOr | BitXor | LAnd | LOr | Multiply | As | Colon => Associativity :: Both ,
436
436
Divide | Equal | Greater | GreaterEqual | Less | LessEqual | Modulus | NotEqual | ShiftLeft | ShiftRight
0 commit comments