Skip to content

Commit 1191620

Browse files
Auto merge of #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 a3f2d5a + 330358a commit 1191620

159 files changed

Lines changed: 2164 additions & 580 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.

Cargo.lock

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -182,19 +182,6 @@ version = "0.7.6"
182182
source = "registry+https://github.com/rust-lang/crates.io-index"
183183
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
184184

185-
[[package]]
186-
name = "askama"
187-
version = "0.14.0"
188-
source = "registry+https://github.com/rust-lang/crates.io-index"
189-
checksum = "f75363874b771be265f4ffe307ca705ef6f3baa19011c149da8674a87f1b75c4"
190-
dependencies = [
191-
"askama_derive 0.14.0",
192-
"itoa",
193-
"percent-encoding",
194-
"serde",
195-
"serde_json",
196-
]
197-
198185
[[package]]
199186
name = "askama"
200187
version = "0.15.1"
@@ -208,30 +195,13 @@ dependencies = [
208195
"serde_json",
209196
]
210197

211-
[[package]]
212-
name = "askama_derive"
213-
version = "0.14.0"
214-
source = "registry+https://github.com/rust-lang/crates.io-index"
215-
checksum = "129397200fe83088e8a68407a8e2b1f826cf0086b21ccdb866a722c8bcd3a94f"
216-
dependencies = [
217-
"askama_parser 0.14.0",
218-
"basic-toml",
219-
"memchr",
220-
"proc-macro2",
221-
"quote",
222-
"rustc-hash 2.1.1",
223-
"serde",
224-
"serde_derive",
225-
"syn 2.0.110",
226-
]
227-
228198
[[package]]
229199
name = "askama_derive"
230200
version = "0.15.1"
231201
source = "registry+https://github.com/rust-lang/crates.io-index"
232202
checksum = "8ba5e7259a1580c61571e3116ebaaa01e3c001b2132b17c4cc5c70780ca3e994"
233203
dependencies = [
234-
"askama_parser 0.15.1",
204+
"askama_parser",
235205
"basic-toml",
236206
"memchr",
237207
"proc-macro2",
@@ -248,19 +218,7 @@ version = "0.15.1"
248218
source = "registry+https://github.com/rust-lang/crates.io-index"
249219
checksum = "236ce20b77cb13506eaf5024899f4af6e12e8825f390bd943c4c37fd8f322e46"
250220
dependencies = [
251-
"askama_derive 0.15.1",
252-
]
253-
254-
[[package]]
255-
name = "askama_parser"
256-
version = "0.14.0"
257-
source = "registry+https://github.com/rust-lang/crates.io-index"
258-
checksum = "d6ab5630b3d5eaf232620167977f95eb51f3432fc76852328774afbd242d4358"
259-
dependencies = [
260-
"memchr",
261-
"serde",
262-
"serde_derive",
263-
"winnow 0.7.13",
221+
"askama_derive",
264222
]
265223

266224
[[package]]
@@ -675,7 +633,7 @@ name = "clippy"
675633
version = "0.1.94"
676634
dependencies = [
677635
"anstream",
678-
"askama 0.14.0",
636+
"askama",
679637
"cargo_metadata 0.18.1",
680638
"clippy_config",
681639
"clippy_lints",
@@ -1566,7 +1524,7 @@ name = "generate-copyright"
15661524
version = "0.1.0"
15671525
dependencies = [
15681526
"anyhow",
1569-
"askama 0.15.1",
1527+
"askama",
15701528
"cargo_metadata 0.21.0",
15711529
"serde",
15721530
"serde_json",
@@ -4913,7 +4871,7 @@ name = "rustdoc"
49134871
version = "0.0.0"
49144872
dependencies = [
49154873
"arrayvec",
4916-
"askama 0.15.1",
4874+
"askama",
49174875
"base64",
49184876
"expect-test",
49194877
"indexmap",

src/tools/clippy/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

src/tools/clippy/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"

src/tools/clippy/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.

src/tools/clippy/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

src/tools/clippy/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
}

src/tools/clippy/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
{

src/tools/clippy/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;

src/tools/clippy/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
}

0 commit comments

Comments
 (0)