Fix even more clippy warnings
This commit is contained in:
parent
bfecb18771
commit
57c6ed0c07
53 changed files with 276 additions and 520 deletions
|
@ -272,10 +272,7 @@ impl GenericArg<'_> {
|
|||
}
|
||||
|
||||
pub fn is_const(&self) -> bool {
|
||||
match self {
|
||||
GenericArg::Const(_) => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(self, GenericArg::Const(_))
|
||||
}
|
||||
|
||||
pub fn descr(&self) -> &'static str {
|
||||
|
@ -980,17 +977,11 @@ impl BinOpKind {
|
|||
}
|
||||
|
||||
pub fn is_lazy(self) -> bool {
|
||||
match self {
|
||||
BinOpKind::And | BinOpKind::Or => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(self, BinOpKind::And | BinOpKind::Or)
|
||||
}
|
||||
|
||||
pub fn is_shift(self) -> bool {
|
||||
match self {
|
||||
BinOpKind::Shl | BinOpKind::Shr => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(self, BinOpKind::Shl | BinOpKind::Shr)
|
||||
}
|
||||
|
||||
pub fn is_comparison(self) -> bool {
|
||||
|
@ -1070,10 +1061,7 @@ impl UnOp {
|
|||
|
||||
/// Returns `true` if the unary operator takes its argument by value.
|
||||
pub fn is_by_value(self) -> bool {
|
||||
match self {
|
||||
Self::UnNeg | Self::UnNot => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(self, Self::UnNeg | Self::UnNot)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1409,10 +1397,9 @@ impl Expr<'_> {
|
|||
/// on the given expression should be considered a place expression.
|
||||
pub fn is_place_expr(&self, mut allow_projections_from: impl FnMut(&Self) -> bool) -> bool {
|
||||
match self.kind {
|
||||
ExprKind::Path(QPath::Resolved(_, ref path)) => match path.res {
|
||||
Res::Local(..) | Res::Def(DefKind::Static, _) | Res::Err => true,
|
||||
_ => false,
|
||||
},
|
||||
ExprKind::Path(QPath::Resolved(_, ref path)) => {
|
||||
matches!(path.res, Res::Local(..) | Res::Def(DefKind::Static, _) | Res::Err)
|
||||
}
|
||||
|
||||
// Type ascription inherits its place expression kind from its
|
||||
// operand. See:
|
||||
|
@ -2204,10 +2191,7 @@ pub enum ImplicitSelfKind {
|
|||
impl ImplicitSelfKind {
|
||||
/// Does this represent an implicit self?
|
||||
pub fn has_implicit_self(&self) -> bool {
|
||||
match *self {
|
||||
ImplicitSelfKind::None => false,
|
||||
_ => true,
|
||||
}
|
||||
!matches!(*self, ImplicitSelfKind::None)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2237,10 +2221,7 @@ impl Defaultness {
|
|||
}
|
||||
|
||||
pub fn is_default(&self) -> bool {
|
||||
match *self {
|
||||
Defaultness::Default { .. } => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(*self, Defaultness::Default { .. })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2371,10 +2352,7 @@ pub enum VisibilityKind<'hir> {
|
|||
|
||||
impl VisibilityKind<'_> {
|
||||
pub fn is_pub(&self) -> bool {
|
||||
match *self {
|
||||
VisibilityKind::Public => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(*self, VisibilityKind::Public)
|
||||
}
|
||||
|
||||
pub fn is_pub_restricted(&self) -> bool {
|
||||
|
@ -2502,10 +2480,7 @@ pub struct FnHeader {
|
|||
|
||||
impl FnHeader {
|
||||
pub fn is_const(&self) -> bool {
|
||||
match &self.constness {
|
||||
Constness::Const => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(&self.constness, Constness::Const)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,10 +92,7 @@ impl hir::Pat<'_> {
|
|||
/// Checks if the pattern contains any patterns that bind something to
|
||||
/// an ident, e.g., `foo`, or `Foo(foo)` or `foo @ Bar(..)`.
|
||||
pub fn contains_bindings(&self) -> bool {
|
||||
self.satisfies(|p| match p.kind {
|
||||
PatKind::Binding(..) => true,
|
||||
_ => false,
|
||||
})
|
||||
self.satisfies(|p| matches!(p.kind, PatKind::Binding(..)))
|
||||
}
|
||||
|
||||
/// Checks if the pattern satisfies the given predicate on some sub-pattern.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue