Skip to content

Commit 43077ee

Browse files
Auto merge of rust-lang#150818 - flip1995:clippy-subtree-update, r=Manishearth,samueltardieu
Clippy subtree update r? Manishearth Cargo.lock update due to askama bump to be in line with the Rust repo.
2 parents c5d0c45 + 697e9e2 commit 43077ee

158 files changed

Lines changed: 2159 additions & 533 deletions

File tree

Some content is hidden

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

COPYRIGHT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// REUSE-IgnoreStart
22

3-
Copyright 2014-2025 The Rust Project Developers
3+
Copyright (c) The Rust Project Contributors
44

55
Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
66
http://www.apache.org/licenses/LICENSE-2.0> or the MIT license

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ walkdir = "2.3"
4242
filetime = "0.2.9"
4343
itertools = "0.12"
4444
pulldown-cmark = { version = "0.11", default-features = false, features = ["html"] }
45-
askama = { version = "0.14", default-features = false, features = ["alloc", "config", "derive"] }
45+
askama = { version = "0.15", default-features = false, features = ["alloc", "config", "derive"] }
4646

4747
[dev-dependencies.toml]
4848
version = "0.9.7"

LICENSE-APACHE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work.
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2014-2025 The Rust Project Developers
189+
Copyright (c) The Rust Project Contributors
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

LICENSE-MIT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2014-2025 The Rust Project Developers
3+
Copyright (c) The Rust Project Contributors
44

55
Permission is hereby granted, free of charge, to any
66
person obtaining a copy of this software and associated

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ If you want to contribute to Clippy, you can find more information in [CONTRIBUT
277277

278278
<!-- REUSE-IgnoreStart -->
279279

280-
Copyright 2014-2025 The Rust Project Developers
280+
Copyright (c) The Rust Project Contributors
281281

282282
Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
283283
[https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)> or the MIT license
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use super::ALLOW_ATTRIBUTES;
22
use clippy_utils::diagnostics::span_lint_and_then;
33
use clippy_utils::is_from_proc_macro;
4+
use rustc_ast::attr::AttributeExt;
45
use rustc_ast::{AttrStyle, Attribute};
56
use rustc_errors::Applicability;
67
use rustc_lint::{EarlyContext, LintContext};
7-
use rustc_ast::attr::AttributeExt;
88

99
// Separate each crate's features.
1010
pub fn check<'cx>(cx: &EarlyContext<'cx>, attr: &'cx Attribute) {
@@ -15,12 +15,7 @@ pub fn check<'cx>(cx: &EarlyContext<'cx>, attr: &'cx Attribute) {
1515
{
1616
#[expect(clippy::collapsible_span_lint_calls, reason = "rust-clippy#7797")]
1717
span_lint_and_then(cx, ALLOW_ATTRIBUTES, path_span, "#[allow] attribute found", |diag| {
18-
diag.span_suggestion(
19-
path_span,
20-
"replace it with",
21-
"expect",
22-
Applicability::MachineApplicable,
23-
);
18+
diag.span_suggestion(path_span, "replace it with", "expect", Applicability::MachineApplicable);
2419
});
2520
}
2621
}

clippy_lints/src/attrs/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ mod utils;
1616
use clippy_config::Conf;
1717
use clippy_utils::diagnostics::span_lint_and_help;
1818
use clippy_utils::msrvs::{self, Msrv, MsrvStack};
19-
use rustc_ast::{self as ast, AttrArgs, AttrKind, Attribute, MetaItemInner, MetaItemKind, AttrItemKind};
19+
use rustc_ast::{self as ast, AttrArgs, AttrItemKind, AttrKind, Attribute, MetaItemInner, MetaItemKind};
2020
use rustc_hir::{ImplItem, Item, ItemKind, TraitItem};
2121
use rustc_lint::{EarlyContext, EarlyLintPass, LateContext, LateLintPass};
2222
use rustc_session::impl_lint_pass;
@@ -604,7 +604,9 @@ impl EarlyLintPass for PostExpansionEarlyAttributes {
604604

605605
if attr.has_name(sym::ignore)
606606
&& match &attr.kind {
607-
AttrKind::Normal(normal_attr) => !matches!(normal_attr.item.args, AttrItemKind::Unparsed(AttrArgs::Eq { .. })),
607+
AttrKind::Normal(normal_attr) => {
608+
!matches!(normal_attr.item.args, AttrItemKind::Unparsed(AttrArgs::Eq { .. }))
609+
},
608610
AttrKind::DocComment(..) => true,
609611
}
610612
{

clippy_lints/src/attrs/should_panic_without_expect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use super::{Attribute, SHOULD_PANIC_WITHOUT_EXPECT};
22
use clippy_utils::diagnostics::span_lint_and_sugg;
33
use rustc_ast::token::{Token, TokenKind};
44
use rustc_ast::tokenstream::TokenTree;
5-
use rustc_ast::{AttrArgs, AttrKind, AttrItemKind};
5+
use rustc_ast::{AttrArgs, AttrItemKind, AttrKind};
66
use rustc_errors::Applicability;
77
use rustc_lint::EarlyContext;
88
use rustc_span::sym;

clippy_lints/src/bool_assert_comparison.rs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use clippy_utils::diagnostics::span_lint_and_then;
22
use clippy_utils::macros::{find_assert_eq_args, root_macro_call_first_node};
3+
use clippy_utils::source::walk_span_to_context;
34
use clippy_utils::sugg::Sugg;
45
use clippy_utils::sym;
56
use clippy_utils::ty::{implements_trait, is_copy};
@@ -130,22 +131,24 @@ impl<'tcx> LateLintPass<'tcx> for BoolAssertComparison {
130131

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

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()
140-
};
141-
suggestions.push((non_lit_expr.span, sugg.to_string()));
134+
let mut applicability = Applicability::MachineApplicable;
135+
let sugg = Sugg::hir_with_context(cx, non_lit_expr, macro_call.span.ctxt(), "..", &mut applicability);
136+
let sugg = if bool_value ^ eq_macro {
137+
!sugg.maybe_paren()
138+
} else if ty::Bool == *non_lit_ty.kind() {
139+
sugg
140+
} else {
141+
!!sugg.maybe_paren()
142+
};
143+
let non_lit_expr_span =
144+
walk_span_to_context(non_lit_expr.span, macro_call.span.ctxt()).unwrap_or(non_lit_expr.span);
145+
suggestions.push((non_lit_expr_span, sugg.to_string()));
142146

143-
diag.multipart_suggestion(
144-
format!("replace it with `{non_eq_mac}!(..)`"),
145-
suggestions,
146-
Applicability::MachineApplicable,
147-
);
148-
}
147+
diag.multipart_suggestion(
148+
format!("replace it with `{non_eq_mac}!(..)`"),
149+
suggestions,
150+
applicability,
151+
);
149152
},
150153
);
151154
}

clippy_lints/src/booleans.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use rustc_lint::{LateContext, LateLintPass, Level};
1515
use rustc_session::impl_lint_pass;
1616
use rustc_span::def_id::LocalDefId;
1717
use rustc_span::{Span, Symbol, SyntaxContext};
18+
use std::fmt::Write as _;
1819

1920
declare_clippy_lint! {
2021
/// ### What it does
@@ -356,7 +357,7 @@ impl SuggestContext<'_, '_, '_> {
356357
if app != Applicability::MachineApplicable {
357358
return None;
358359
}
359-
self.output.push_str(&(!snip).to_string());
360+
let _cannot_fail = write!(&mut self.output, "{}", &(!snip));
360361
}
361362
},
362363
True | False | Not(_) => {

0 commit comments

Comments
 (0)