diff options
| author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2021-02-09 11:15:53 +0300 |
|---|---|---|
| committer | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2021-02-09 11:39:20 +0300 |
| commit | c4e3558b8c8af8ced8ea3b4b018bc6bccbb0ff73 (patch) | |
| tree | 7adabb5773fae255e56688e8bb3b5b3028e48955 /src/tools/clippy/tests | |
| parent | 36931ce3d90e1927e8589d973cc8d18103ede460 (diff) | |
| download | rust-c4e3558b8c8af8ced8ea3b4b018bc6bccbb0ff73.tar.gz rust-c4e3558b8c8af8ced8ea3b4b018bc6bccbb0ff73.zip | |
Rename HIR UnOp variants
This renames the variants in HIR UnOp from
enum UnOp {
UnDeref,
UnNot,
UnNeg,
}
to
enum UnOp {
Deref,
Not,
Neg,
}
Motivations:
- This is more consistent with the rest of the code base where most enum
variants don't have a prefix.
- These variants are never used without the `UnOp` prefix so the extra
`Un` prefix doesn't help with readability. E.g. we don't have any
`UnDeref`s in the code, we only have `UnOp::UnDeref`.
- MIR `UnOp` type variants don't have a prefix so this is more
consistent with MIR types.
- "un" prefix reads like "inverse" or "reverse", so as a beginner in
rustc code base when I see "UnDeref" what comes to my mind is
something like "&*" instead of just "*".
Diffstat (limited to 'src/tools/clippy/tests')
| -rw-r--r-- | src/tools/clippy/tests/ui/suspicious_arithmetic_impl.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tools/clippy/tests/ui/suspicious_arithmetic_impl.rs b/src/tools/clippy/tests/ui/suspicious_arithmetic_impl.rs index 5c280efac1a..ae253a0487c 100644 --- a/src/tools/clippy/tests/ui/suspicious_arithmetic_impl.rs +++ b/src/tools/clippy/tests/ui/suspicious_arithmetic_impl.rs @@ -117,7 +117,7 @@ impl Add for Bar { type Output = Bar; fn add(self, other: Self) -> Self { - Bar(self.0 & !other.0) // OK: UnNot part of BiExpr as child node + Bar(self.0 & !other.0) // OK: Not part of BiExpr as child node } } @@ -126,7 +126,7 @@ impl Sub for Bar { fn sub(self, other: Self) -> Self { if self.0 <= other.0 { - Bar(-(self.0 & other.0)) // OK: UnNeg part of BiExpr as parent node + Bar(-(self.0 & other.0)) // OK: Neg part of BiExpr as parent node } else { Bar(0) } |
