Skip to content

Commit 0e9321d

Browse files
committed
Auto merge of #9516 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents 0f6932a + d792c3a commit 0e9321d

File tree

103 files changed

+599
-502
lines changed

Some content is hidden

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

103 files changed

+599
-502
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.65"
3+
version = "0.1.66"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_dev/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(let_chains)]
2-
#![feature(let_else)]
32
#![feature(once_cell)]
43
#![feature(rustc_private)]
54
#![cfg_attr(feature = "deny-warnings", deny(warnings))]

clippy_dev/src/new_lint.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,17 @@ fn add_lint(lint: &LintData<'_>, enable_msrv: bool) -> io::Result<()> {
120120

121121
let new_lint = if enable_msrv {
122122
format!(
123-
"store.register_{lint_pass}_pass(move || Box::new({module_name}::{camel_name}::new(msrv)));\n ",
123+
"store.register_{lint_pass}_pass(move |{ctor_arg}| Box::new({module_name}::{camel_name}::new(msrv)));\n ",
124124
lint_pass = lint.pass,
125+
ctor_arg = if lint.pass == "late" { "_" } else { "" },
125126
module_name = lint.name,
126127
camel_name = to_camel_case(lint.name),
127128
)
128129
} else {
129130
format!(
130-
"store.register_{lint_pass}_pass(|| Box::new({module_name}::{camel_name}));\n ",
131+
"store.register_{lint_pass}_pass(|{ctor_arg}| Box::new({module_name}::{camel_name}));\n ",
131132
lint_pass = lint.pass,
133+
ctor_arg = if lint.pass == "late" { "_" } else { "" },
132134
module_name = lint.name,
133135
camel_name = to_camel_case(lint.name),
134136
)

clippy_lints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_lints"
3-
version = "0.1.65"
3+
version = "0.1.66"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_lints/src/default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl<'tcx> LateLintPass<'tcx> for Default {
142142
if adt.is_struct();
143143
let variant = adt.non_enum_variant();
144144
if adt.did().is_local() || !variant.is_field_list_non_exhaustive();
145-
let module_did = cx.tcx.parent_module(stmt.hir_id).to_def_id();
145+
let module_did = cx.tcx.parent_module(stmt.hir_id);
146146
if variant
147147
.fields
148148
.iter()

clippy_lints/src/default_union_representation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use clippy_utils::diagnostics::span_lint_and_help;
22
use rustc_hir::{self as hir, HirId, Item, ItemKind};
3+
use rustc_hir_analysis::hir_ty_to_ty;
34
use rustc_lint::{LateContext, LateLintPass};
45
use rustc_middle::ty::layout::LayoutOf;
56
use rustc_session::{declare_lint_pass, declare_tool_lint};
67
use rustc_span::sym;
7-
use rustc_typeck::hir_ty_to_ty;
88

99
declare_clippy_lint! {
1010
/// ### What it does

clippy_lints/src/dereference.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_infer::infer::TyCtxtInferExt;
2020
use rustc_lint::{LateContext, LateLintPass};
2121
use rustc_middle::ty::adjustment::{Adjust, Adjustment, AutoBorrow, AutoBorrowMutability};
2222
use rustc_middle::ty::{
23-
self, subst::Subst, Binder, BoundVariableKind, EarlyBinder, FnSig, GenericArgKind, List, ParamTy, PredicateKind,
23+
self, Binder, BoundVariableKind, EarlyBinder, FnSig, GenericArgKind, List, ParamTy, PredicateKind,
2424
ProjectionPredicate, Ty, TyCtxt, TypeVisitable, TypeckResults,
2525
};
2626
use rustc_semver::RustcVersion;
@@ -704,7 +704,7 @@ fn walk_parents<'tcx>(
704704
span,
705705
..
706706
}) if span.ctxt() == ctxt => {
707-
let ty = cx.tcx.type_of(def_id);
707+
let ty = cx.tcx.type_of(def_id.def_id);
708708
Some(ty_auto_deref_stability(cx, ty, precedence).position_for_result(cx))
709709
},
710710

clippy_lints/src/derive.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_middle::hir::nested_filter;
1515
use rustc_middle::traits::Reveal;
1616
use rustc_middle::ty::{
1717
self, Binder, BoundConstness, GenericParamDefKind, ImplPolarity, ParamEnv, PredicateKind, TraitPredicate, TraitRef,
18-
Ty, TyCtxt, Visibility,
18+
Ty, TyCtxt,
1919
};
2020
use rustc_session::{declare_lint_pass, declare_tool_lint};
2121
use rustc_span::source_map::Span;
@@ -425,7 +425,7 @@ struct UnsafeVisitor<'a, 'tcx> {
425425
impl<'tcx> Visitor<'tcx> for UnsafeVisitor<'_, 'tcx> {
426426
type NestedFilter = nested_filter::All;
427427

428-
fn visit_fn(&mut self, kind: FnKind<'tcx>, decl: &'tcx FnDecl<'_>, body_id: BodyId, span: Span, id: HirId) {
428+
fn visit_fn(&mut self, kind: FnKind<'tcx>, decl: &'tcx FnDecl<'_>, body_id: BodyId, _: Span, id: HirId) {
429429
if self.has_unsafe {
430430
return;
431431
}
@@ -438,7 +438,7 @@ impl<'tcx> Visitor<'tcx> for UnsafeVisitor<'_, 'tcx> {
438438
}
439439
}
440440

441-
walk_fn(self, kind, decl, body_id, span, id);
441+
walk_fn(self, kind, decl, body_id, id);
442442
}
443443

444444
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
@@ -464,7 +464,7 @@ impl<'tcx> Visitor<'tcx> for UnsafeVisitor<'_, 'tcx> {
464464
fn check_partial_eq_without_eq<'tcx>(cx: &LateContext<'tcx>, span: Span, trait_ref: &hir::TraitRef<'_>, ty: Ty<'tcx>) {
465465
if_chain! {
466466
if let ty::Adt(adt, substs) = ty.kind();
467-
if cx.tcx.visibility(adt.did()) == Visibility::Public;
467+
if cx.tcx.visibility(adt.did()).is_public();
468468
if let Some(eq_trait_def_id) = cx.tcx.get_diagnostic_item(sym::Eq);
469469
if let Some(def_id) = trait_ref.trait_def_id();
470470
if cx.tcx.is_diagnostic_item(sym::PartialEq, def_id);

clippy_lints/src/disallowed_types.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use clippy_utils::diagnostics::span_lint_and_then;
22

33
use rustc_data_structures::fx::FxHashMap;
4-
use rustc_hir::{
5-
def::Res, def_id::DefId, Item, ItemKind, PolyTraitRef, PrimTy, TraitBoundModifier, Ty, TyKind, UseKind,
6-
};
4+
use rustc_hir::{def::Res, def_id::DefId, Item, ItemKind, PolyTraitRef, PrimTy, Ty, TyKind, UseKind};
75
use rustc_lint::{LateContext, LateLintPass};
86
use rustc_session::{declare_tool_lint, impl_lint_pass};
97
use rustc_span::Span;
@@ -120,7 +118,7 @@ impl<'tcx> LateLintPass<'tcx> for DisallowedTypes {
120118
}
121119
}
122120

123-
fn check_poly_trait_ref(&mut self, cx: &LateContext<'tcx>, poly: &'tcx PolyTraitRef<'tcx>, _: TraitBoundModifier) {
121+
fn check_poly_trait_ref(&mut self, cx: &LateContext<'tcx>, poly: &'tcx PolyTraitRef<'tcx>) {
124122
self.check_res_emit(cx, &poly.trait_ref.path.res, poly.trait_ref.path.span);
125123
}
126124
}

clippy_lints/src/doc.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,19 @@ impl<'tcx> LateLintPass<'tcx> for DocMarkdown {
233233
let body = cx.tcx.hir().body(body_id);
234234
let mut fpu = FindPanicUnwrap {
235235
cx,
236-
typeck_results: cx.tcx.typeck(item.def_id),
236+
typeck_results: cx.tcx.typeck(item.def_id.def_id),
237237
panic_span: None,
238238
};
239239
fpu.visit_expr(body.value);
240-
lint_for_missing_headers(cx, item.def_id, item.span, sig, headers, Some(body_id), fpu.panic_span);
240+
lint_for_missing_headers(
241+
cx,
242+
item.def_id.def_id,
243+
item.span,
244+
sig,
245+
headers,
246+
Some(body_id),
247+
fpu.panic_span,
248+
);
241249
}
242250
},
243251
hir::ItemKind::Impl(impl_) => {
@@ -268,7 +276,7 @@ impl<'tcx> LateLintPass<'tcx> for DocMarkdown {
268276
let headers = check_attrs(cx, &self.valid_idents, attrs);
269277
if let hir::TraitItemKind::Fn(ref sig, ..) = item.kind {
270278
if !in_external_macro(cx.tcx.sess, item.span) {
271-
lint_for_missing_headers(cx, item.def_id, item.span, sig, headers, None, None);
279+
lint_for_missing_headers(cx, item.def_id.def_id, item.span, sig, headers, None, None);
272280
}
273281
}
274282
}
@@ -283,11 +291,19 @@ impl<'tcx> LateLintPass<'tcx> for DocMarkdown {
283291
let body = cx.tcx.hir().body(body_id);
284292
let mut fpu = FindPanicUnwrap {
285293
cx,
286-
typeck_results: cx.tcx.typeck(item.def_id),
294+
typeck_results: cx.tcx.typeck(item.def_id.def_id),
287295
panic_span: None,
288296
};
289297
fpu.visit_expr(body.value);
290-
lint_for_missing_headers(cx, item.def_id, item.span, sig, headers, Some(body_id), fpu.panic_span);
298+
lint_for_missing_headers(
299+
cx,
300+
item.def_id.def_id,
301+
item.span,
302+
sig,
303+
headers,
304+
Some(body_id),
305+
fpu.panic_span,
306+
);
291307
}
292308
}
293309
}

0 commit comments

Comments
 (0)