Skip to content

Commit 44a5eda

Browse files
committed
Auto merge of #12507 - Alexendoo:unused-qualifications, r=dswij
Enable unused_qualifications lint Fixes a common nit changelog: none
2 parents 52b2a5e + a24d12b commit 44a5eda

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+349
-349
lines changed

clippy_config/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#![feature(rustc_private, let_chains)]
22
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
3-
#![warn(rust_2018_idioms, unused_lifetimes)]
3+
#![warn(
4+
trivial_casts,
5+
trivial_numeric_casts,
6+
rust_2018_idioms,
7+
unused_lifetimes,
8+
unused_qualifications
9+
)]
410
#![allow(
511
clippy::must_use_candidate,
612
clippy::missing_panics_doc,

clippy_dev/src/lib.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22
#![feature(let_chains)]
33
#![feature(rustc_private)]
44
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
5-
// warn on lints, that are included in `rust-lang/rust`s bootstrap
6-
#![warn(rust_2018_idioms, unused_lifetimes)]
5+
#![warn(
6+
trivial_casts,
7+
trivial_numeric_casts,
8+
rust_2018_idioms,
9+
unused_lifetimes,
10+
unused_qualifications
11+
)]
712

813
// The `rustc_driver` crate seems to be required in order to use the `rust_lexer` crate.
914
#[allow(unused_extern_crates)]

clippy_dev/src/update_lints.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ fn replace_region_in_text<'a>(
992992
}
993993

994994
fn try_rename_file(old_name: &Path, new_name: &Path) -> bool {
995-
match fs::OpenOptions::new().create_new(true).write(true).open(new_name) {
995+
match OpenOptions::new().create_new(true).write(true).open(new_name) {
996996
Ok(file) => drop(file),
997997
Err(e) if matches!(e.kind(), io::ErrorKind::AlreadyExists | io::ErrorKind::NotFound) => return false,
998998
Err(e) => panic_file(e, new_name, "create"),
@@ -1016,7 +1016,7 @@ fn panic_file(error: io::Error, name: &Path, action: &str) -> ! {
10161016
}
10171017

10181018
fn rewrite_file(path: &Path, f: impl FnOnce(&str) -> Option<String>) {
1019-
let mut file = fs::OpenOptions::new()
1019+
let mut file = OpenOptions::new()
10201020
.write(true)
10211021
.read(true)
10221022
.open(path)

clippy_lints/src/assigning_clones.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl AssigningClones {
6565
impl_lint_pass!(AssigningClones => [ASSIGNING_CLONES]);
6666

6767
impl<'tcx> LateLintPass<'tcx> for AssigningClones {
68-
fn check_expr(&mut self, cx: &LateContext<'tcx>, assign_expr: &'tcx hir::Expr<'_>) {
68+
fn check_expr(&mut self, cx: &LateContext<'tcx>, assign_expr: &'tcx Expr<'_>) {
6969
// Do not fire the lint in macros
7070
let expn_data = assign_expr.span().ctxt().outer_expn_data();
7171
match expn_data.kind {
@@ -205,12 +205,7 @@ fn is_ok_to_suggest<'tcx>(cx: &LateContext<'tcx>, lhs: &Expr<'tcx>, call: &CallC
205205
implemented_fns.contains_key(&provided_fn.def_id)
206206
}
207207

208-
fn suggest<'tcx>(
209-
cx: &LateContext<'tcx>,
210-
assign_expr: &hir::Expr<'tcx>,
211-
lhs: &hir::Expr<'tcx>,
212-
call: &CallCandidate<'tcx>,
213-
) {
208+
fn suggest<'tcx>(cx: &LateContext<'tcx>, assign_expr: &Expr<'tcx>, lhs: &Expr<'tcx>, call: &CallCandidate<'tcx>) {
214209
span_lint_and_then(cx, ASSIGNING_CLONES, assign_expr.span, call.message(), |diag| {
215210
let mut applicability = Applicability::MachineApplicable;
216211

@@ -263,7 +258,7 @@ impl<'tcx> CallCandidate<'tcx> {
263258
fn suggested_replacement(
264259
&self,
265260
cx: &LateContext<'tcx>,
266-
lhs: &hir::Expr<'tcx>,
261+
lhs: &Expr<'tcx>,
267262
applicability: &mut Applicability,
268263
) -> String {
269264
match self.target {

clippy_lints/src/booleans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,13 @@ fn simple_negate(b: Bool) -> Bool {
392392
t @ Term(_) => Not(Box::new(t)),
393393
And(mut v) => {
394394
for el in &mut v {
395-
*el = simple_negate(::std::mem::replace(el, True));
395+
*el = simple_negate(std::mem::replace(el, True));
396396
}
397397
Or(v)
398398
},
399399
Or(mut v) => {
400400
for el in &mut v {
401-
*el = simple_negate(::std::mem::replace(el, True));
401+
*el = simple_negate(std::mem::replace(el, True));
402402
}
403403
And(v)
404404
},

clippy_lints/src/box_default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ fn is_local_vec_expn(cx: &LateContext<'_>, expr: &Expr<'_>, ref_expr: &Expr<'_>)
127127
struct InferVisitor(bool);
128128

129129
impl<'tcx> Visitor<'tcx> for InferVisitor {
130-
fn visit_ty(&mut self, t: &rustc_hir::Ty<'_>) {
130+
fn visit_ty(&mut self, t: &Ty<'_>) {
131131
self.0 |= matches!(t.kind, TyKind::Infer | TyKind::OpaqueDef(..) | TyKind::TraitObject(..));
132132
if !self.0 {
133133
walk_ty(self, t);

clippy_lints/src/collection_is_never_read.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl<'tcx> LateLintPass<'tcx> for CollectionIsNeverRead {
7070
}
7171
}
7272

73-
fn match_acceptable_type(cx: &LateContext<'_>, local: &Local<'_>, collections: &[rustc_span::Symbol]) -> bool {
73+
fn match_acceptable_type(cx: &LateContext<'_>, local: &Local<'_>, collections: &[Symbol]) -> bool {
7474
let ty = cx.typeck_results().pat_ty(local.pat);
7575
collections.iter().any(|&sym| is_type_diagnostic_item(cx, ty, sym))
7676
// String type is a lang item but not a diagnostic item for now so we need a separate check

clippy_lints/src/default_constructed_unit_structs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fn is_alias(ty: hir::Ty<'_>) -> bool {
5656

5757
impl LateLintPass<'_> for DefaultConstructedUnitStructs {
5858
fn check_expr<'tcx>(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) {
59-
if let hir::ExprKind::Call(fn_expr, &[]) = expr.kind
59+
if let ExprKind::Call(fn_expr, &[]) = expr.kind
6060
// make sure we have a call to `Default::default`
6161
&& let ExprKind::Path(ref qpath @ hir::QPath::TypeRelative(base, _)) = fn_expr.kind
6262
// make sure this isn't a type alias:

clippy_lints/src/default_instead_of_iter_empty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl<'tcx> LateLintPass<'tcx> for DefaultIterEmpty {
6060

6161
fn make_sugg(
6262
cx: &LateContext<'_>,
63-
ty_path: &rustc_hir::QPath<'_>,
63+
ty_path: &QPath<'_>,
6464
ctxt: SyntaxContext,
6565
applicability: &mut Applicability,
6666
path: &str,

clippy_lints/src/derivable_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fn is_path_self(e: &Expr<'_>) -> bool {
7979
fn contains_trait_object(ty: Ty<'_>) -> bool {
8080
match ty.kind() {
8181
ty::Ref(_, ty, _) => contains_trait_object(*ty),
82-
ty::Adt(def, args) => def.is_box() && args[0].as_type().map_or(false, contains_trait_object),
82+
Adt(def, args) => def.is_box() && args[0].as_type().map_or(false, contains_trait_object),
8383
ty::Dynamic(..) => true,
8484
_ => false,
8585
}

0 commit comments

Comments
 (0)