Skip to content

Commit 8779679

Browse files
authored
Rustup (#15531)
Letting rustbot assign a reviewer, so that someone can double check 9de86f4. changelog: none
2 parents 6d89c55 + 60374e2 commit 8779679

Some content is hidden

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

58 files changed

+430
-305
lines changed

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,7 @@ harness = false
7171
# without increasing total build times.
7272
[profile.dev.package.quine-mc_cluskey]
7373
opt-level = 3
74+
75+
[lints.rust.unexpected_cfgs]
76+
level = "warn"
77+
check-cfg = ['cfg(bootstrap)']

clippy_lints/src/arbitrary_source_item_ordering.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ fn get_item_name(item: &Item<'_>) -> Option<String> {
534534

535535
if let Some(of_trait) = im.of_trait {
536536
let mut trait_segs: Vec<String> = of_trait
537+
.trait_ref
537538
.path
538539
.segments
539540
.iter()

clippy_lints/src/bool_assert_comparison.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,22 @@ impl<'tcx> LateLintPass<'tcx> for BoolAssertComparison {
130130

131131
let mut suggestions = vec![(name_span, non_eq_mac.to_string()), (lit_span, String::new())];
132132

133-
if bool_value ^ eq_macro {
134-
let Some(sugg) = Sugg::hir_opt(cx, non_lit_expr) else {
135-
return;
133+
if let Some(sugg) = Sugg::hir_opt(cx, non_lit_expr) {
134+
let sugg = if bool_value ^ eq_macro {
135+
!sugg.maybe_paren()
136+
} else if ty::Bool == *non_lit_ty.kind() {
137+
sugg
138+
} else {
139+
!!sugg.maybe_paren()
136140
};
137-
suggestions.push((non_lit_expr.span, (!sugg).to_string()));
138-
}
141+
suggestions.push((non_lit_expr.span, sugg.to_string()));
139142

140-
diag.multipart_suggestion(
141-
format!("replace it with `{non_eq_mac}!(..)`"),
142-
suggestions,
143-
Applicability::MachineApplicable,
144-
);
143+
diag.multipart_suggestion(
144+
format!("replace it with `{non_eq_mac}!(..)`"),
145+
suggestions,
146+
Applicability::MachineApplicable,
147+
);
148+
}
145149
},
146150
);
147151
}

clippy_lints/src/copy_iterator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ declare_lint_pass!(CopyIterator => [COPY_ITERATOR]);
3737
impl<'tcx> LateLintPass<'tcx> for CopyIterator {
3838
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
3939
if let ItemKind::Impl(Impl {
40-
of_trait: Some(trait_ref),
40+
of_trait: Some(of_trait),
4141
..
4242
}) = item.kind
4343
&& let ty = cx.tcx.type_of(item.owner_id).instantiate_identity()
4444
&& is_copy(cx, ty)
45-
&& let Some(trait_id) = trait_ref.trait_def_id()
45+
&& let Some(trait_id) = of_trait.trait_ref.trait_def_id()
4646
&& cx.tcx.is_diagnostic_item(sym::Iterator, trait_id)
4747
{
4848
span_lint_and_note(

clippy_lints/src/derivable_impls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,14 @@ fn check_enum<'tcx>(cx: &LateContext<'tcx>, item: &'tcx Item<'_>, func_expr: &Ex
183183
impl<'tcx> LateLintPass<'tcx> for DerivableImpls {
184184
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
185185
if let ItemKind::Impl(Impl {
186-
of_trait: Some(trait_ref),
186+
of_trait: Some(of_trait),
187187
items: [child],
188188
self_ty,
189189
..
190190
}) = item.kind
191191
&& !cx.tcx.is_automatically_derived(item.owner_id.to_def_id())
192192
&& !item.span.from_expansion()
193-
&& let Some(def_id) = trait_ref.trait_def_id()
193+
&& let Some(def_id) = of_trait.trait_ref.trait_def_id()
194194
&& cx.tcx.is_diagnostic_item(sym::Default, def_id)
195195
&& let impl_item_hir = child.hir_id()
196196
&& let Node::ImplItem(impl_item) = cx.tcx.hir_node(impl_item_hir)

clippy_lints/src/derive.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,11 @@ declare_lint_pass!(Derive => [
201201
impl<'tcx> LateLintPass<'tcx> for Derive {
202202
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
203203
if let ItemKind::Impl(Impl {
204-
of_trait: Some(trait_ref),
204+
of_trait: Some(of_trait),
205205
..
206206
}) = item.kind
207207
{
208+
let trait_ref = &of_trait.trait_ref;
208209
let ty = cx.tcx.type_of(item.owner_id).instantiate_identity();
209210
let is_automatically_derived = cx.tcx.is_automatically_derived(item.owner_id.to_def_id());
210211

clippy_lints/src/duplicate_mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl_lint_pass!(DuplicateMod => [DUPLICATE_MOD]);
6363

6464
impl EarlyLintPass for DuplicateMod {
6565
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
66-
if let ItemKind::Mod(_, _, ModKind::Loaded(_, Inline::No, mod_spans, _)) = &item.kind
66+
if let ItemKind::Mod(_, _, ModKind::Loaded(_, Inline::No { .. }, mod_spans)) = &item.kind
6767
&& let FileName::Real(real) = cx.sess().source_map().span_to_filename(mod_spans.inner_span)
6868
&& let Some(local_path) = real.into_local_path()
6969
&& let Ok(absolute_path) = local_path.canonicalize()

clippy_lints/src/empty_drop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ declare_lint_pass!(EmptyDrop => [EMPTY_DROP]);
3636
impl LateLintPass<'_> for EmptyDrop {
3737
fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
3838
if let ItemKind::Impl(Impl {
39-
of_trait: Some(trait_ref),
39+
of_trait: Some(of_trait),
4040
items: [child],
4141
..
4242
}) = item.kind
43-
&& trait_ref.trait_def_id() == cx.tcx.lang_items().drop_trait()
43+
&& of_trait.trait_ref.trait_def_id() == cx.tcx.lang_items().drop_trait()
4444
&& let impl_item_hir = child.hir_id()
4545
&& let Node::ImplItem(impl_item) = cx.tcx.hir_node(impl_item_hir)
4646
&& let ImplItemKind::Fn(_, b) = &impl_item.kind

clippy_lints/src/empty_line_after.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ impl EmptyLineAfter {
442442
None => span.shrink_to_lo(),
443443
},
444444
mod_items: match kind {
445-
ItemKind::Mod(_, _, ModKind::Loaded(items, _, _, _)) => items
445+
ItemKind::Mod(_, _, ModKind::Loaded(items, _, _)) => items
446446
.iter()
447447
.filter(|i| !matches!(i.span.ctxt().outer_expn_data().kind, ExpnKind::AstPass(_)))
448448
.map(|i| i.id)

clippy_lints/src/error_impl_error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl<'tcx> LateLintPass<'tcx> for ErrorImplError {
5252
);
5353
},
5454
ItemKind::Impl(imp)
55-
if let Some(trait_def_id) = imp.of_trait.and_then(|t| t.trait_def_id())
55+
if let Some(trait_def_id) = imp.of_trait.and_then(|t| t.trait_ref.trait_def_id())
5656
&& let Some(error_def_id) = cx.tcx.get_diagnostic_item(sym::Error)
5757
&& error_def_id == trait_def_id
5858
&& let Some(def_id) = path_res(cx, imp.self_ty).opt_def_id().and_then(DefId::as_local)

0 commit comments

Comments
 (0)