Skip to content

Commit

Permalink
Fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Dec 20, 2024
1 parent 143570b commit 06d5f30
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_lints/src/no_effect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ fn has_no_effect(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
!has_drop(cx, cx.typeck_results().expr_ty(expr))
&& fields.iter().all(|field| has_no_effect(cx, field.expr))
&& match &base {
StructTailExpr::None | StructTailExpr::DefaultFields(_) => true,
StructTailExpr::None(_)| StructTailExpr::DefaultFields(_) => true,
StructTailExpr::Base(base) => has_no_effect(cx, base),
}
},
Expand Down Expand Up @@ -347,7 +347,7 @@ fn reduce_expression<'a>(cx: &LateContext<'_>, expr: &'a Expr<'a>) -> Option<Vec
} else {
let base = match base {
StructTailExpr::Base(base) => Some(base),
StructTailExpr::None | StructTailExpr::DefaultFields(_) => None,
StructTailExpr::None(_)| StructTailExpr::DefaultFields(_) => None,
};
Some(fields.iter().map(|f| &f.expr).chain(base).map(Deref::deref).collect())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl LateLintPass<'_> for UnnecessaryStruct {
let field_path = same_path_in_all_fields(cx, expr, fields);

let sugg = match (field_path, base) {
(Some(&path), StructTailExpr::None | StructTailExpr::DefaultFields(_)) => {
(Some(&path), StructTailExpr::None(_)| StructTailExpr::DefaultFields(_)) => {
// all fields match, no base given
path.span
},
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/utils/author.rs
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
bind!(self, qpath, fields);
let base = OptionPat::new(match base {
StructTailExpr::Base(base) => Some(self.bind("base", base)),
StructTailExpr::None | StructTailExpr::DefaultFields(_) => None,
StructTailExpr::None(_) | StructTailExpr::DefaultFields(_) => None,
});
kind!("Struct({qpath}, {fields}, {base})");
self.qpath(qpath);
Expand Down

0 comments on commit 06d5f30

Please sign in to comment.