Skip to content

Clippy subtree update #117021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 70 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
6e0c456
triagebot no-merges: exclude "Rustup"s, add labels
pitaj Sep 16, 2023
77c121e
Warn missing_enforced_import_renames by default
taiki-e Sep 20, 2023
faacd55
Fix typo in attrs.rs
eltociear Oct 4, 2023
31fd282
[`get_first`]: lint on non-primitive types
y21 Oct 4, 2023
e6f29f1
dogfood
y21 Oct 4, 2023
010a9b1
Rename `Features::active_features`.
nnethercote Oct 5, 2023
9de3e6c
Add more diagnostic items for clippy
Jarcho Sep 27, 2023
ddd1564
Add regression test for #11610 about mutable usage of argument in asy…
GuillaumeGomez Oct 6, 2023
8ebed4c
Merge commit 'b105fb4c39bc1a010807a6c076193cef8d93c109' into clippyup
flip1995 Oct 6, 2023
68d2082
Fix ice
koka831 Oct 6, 2023
3662bd8
Auto merge of #11623 - koka831:fix/11619, r=llogiq
bors Oct 6, 2023
0ed398e
Rollup merge of #116423 - eltociear:patch-22, r=flip1995
matthiaskrgr Oct 6, 2023
bffba76
Fix two typos in lint description
samueltardieu Oct 7, 2023
1c6fa29
[`into_iter_without_iter`]: look for `iter` method in deref chains
y21 Oct 7, 2023
7624045
Auto merge of #11639 - y21:issue11635, r=llogiq
bors Oct 7, 2023
56400a0
Auto merge of #116437 - nnethercote:rustc_features, r=Nilstrieb
bors Oct 7, 2023
33f49f3
Auto merge of #11638 - samueltardieu:into-iter, r=Manishearth
bors Oct 7, 2023
850f2f5
Update ui_test to 0.21.2
Alexendoo Oct 8, 2023
5ed338d
`impl_trait_in_params` now supports impls and traits
blyxyas Sep 21, 2023
7755737
Fix tests, only lint for public tests
blyxyas Sep 23, 2023
bde0482
Auto merge of #11550 - blyxyas:fix-impl_trait_in_params-for_assocfn, …
bors Oct 8, 2023
929a288
Auto merge of #11645 - Alexendoo:ui_test, r=flip1995
bors Oct 9, 2023
70b8d15
Extend impl's def_span to include where clauses
compiler-errors Oct 6, 2023
0b60531
[`map_identity`]: allow closure with type annotations
y21 Sep 17, 2023
bba155e
move changed logic to into its own util function
y21 Oct 9, 2023
359fa98
Rejig some top-level `rustc_hir_pretty` functions.
nnethercote Oct 10, 2023
0b8495b
Rollup merge of #116625 - nnethercote:rustc_hir_pretty, r=fee1-dead
matthiaskrgr Oct 12, 2023
b5488f9
[`manual_is_ascii_check`]: Also check for `is_ascii_hexdigt`
aDotInTheVoid Oct 12, 2023
ff00e9c
Auto merge of #11659 - aDotInTheVoid:hexdigit, r=Jarcho
bors Oct 12, 2023
eb6fb18
Avoid `panic!`, omit instead
koka831 Oct 13, 2023
9fc717d
add test for macro-in-loop
koka831 Oct 13, 2023
c40359d
Auto merge of #11664 - koka831:fix/11134, r=blyxyas
bors Oct 13, 2023
d179605
Document conflicting lints
c410-f3r Oct 13, 2023
8c0870d
Address comment
c410-f3r Oct 13, 2023
1ffd09a
Stabilize AFIT and RPITIT
compiler-errors Sep 13, 2023
6ed04af
Make `multiple_unsafe_ops_per_block` ignore await desugaring
Noratrieb Oct 8, 2023
bb6516a
[`unnecessary_lazy_eval`]: don't emit autofix suggestion if closure h…
y21 Oct 15, 2023
ef95be5
Auto merge of #11609 - y21:get_first_non_primitives, r=giraffate
bors Oct 15, 2023
ae52ee5
Auto merge of #11514 - pitaj:triagebot_no-merges_exclude-titles, r=fl…
bors Oct 16, 2023
387d756
Auto merge of #11666 - c410-f3r:dsadasewqasdsa, r=flip1995
bors Oct 16, 2023
3960bc0
Now `declare_interior_mutable_const` and `borrow_interior_mutable_con…
slinkydeveloper Oct 16, 2023
9f27b15
Auto merge of #11673 - y21:issue11672, r=Manishearth
bors Oct 16, 2023
2cf708d
Auto merge of #11646 - Nilstrieb:compiler-does-not-comply-with-the-li…
bors Oct 17, 2023
9ee26d0
fix lint failures in clippy
a-lafrance Oct 16, 2023
09535a5
[RFC 3127 - Trim Paths]: Fix building tools (rustdoc, clippy, ...)
Urgau Aug 23, 2023
2640d5c
Auto merge of #11622 - GuillaumeGomez:needless_pass_by_ref_mut-regres…
bors Oct 17, 2023
bc97f7d
Don't emit `needless_pass_by_ref_mut` if the variable is used in an u…
GuillaumeGomez Oct 6, 2023
80a092c
Add test for `needless_pass_by_ref_mut` to ensure that the lint is no…
GuillaumeGomez Oct 6, 2023
d9dc5ee
AliasTy::new instead of tcx method
lcnr Oct 18, 2023
8b02dac
add lint for struct field names
jonboh Oct 17, 2023
5fb312e
Auto merge of #11624 - GuillaumeGomez:needless_pass_by_ref_mut-unsafe…
bors Oct 18, 2023
fe21991
Auto merge of #11496 - jonboh:prefix_postfix_struct, r=y21
bors Oct 18, 2023
ec2b8ab
Fix invalid warning for closure in non-async function for `needless_p…
GuillaumeGomez Oct 6, 2023
3b4b07c
Add test for closure in non-async function for `needless_pass_by_ref_…
GuillaumeGomez Oct 6, 2023
3e6db95
Add regression test for #11561
GuillaumeGomez Oct 6, 2023
1528c1d
Deserialize Msrv directly in Conf
Alexendoo Oct 18, 2023
a07c032
Tweak wording of type errors involving type params
estebank Oct 18, 2023
9574d28
Auto merge of #11683 - Alexendoo:msrv-config, r=Manishearth,flip1995
bors Oct 19, 2023
cd477d4
Auto merge of #11621 - GuillaumeGomez:needless_pass_by_ref_mut-closur…
bors Oct 19, 2023
214b4d9
Auto merge of #115214 - Urgau:rfc-3127-trim-paths, r=compiler-errors
bors Oct 19, 2023
e230f19
Auto merge of #11521 - y21:issue9122, r=llogiq
bors Oct 20, 2023
090df7a
Auto merge of #11678 - slinkydeveloper:master, r=Alexendoo
bors Oct 20, 2023
868e513
s/Generator/Coroutine/
oli-obk Oct 19, 2023
d9259fd
s/generator/coroutine/
oli-obk Oct 19, 2023
23af253
Auto merge of #11539 - taiki-e:enforced-import-renames, r=Centri3
bors Oct 21, 2023
5f03156
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Oct 21, 2023
a585cda
Bump nightly version -> 2023-10-21
flip1995 Oct 21, 2023
2b030eb
Auto merge of #11694 - flip1995:rustup, r=flip1995
bors Oct 21, 2023
24b3554
Merge commit '2b030eb03d9e5837440b1ee0b98c50b97c0c5889' into clippyup
flip1995 Oct 21, 2023
b8b55fe
Update Cargo.lock (ui_test update)
flip1995 Oct 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge commit 'b105fb4c39bc1a010807a6c076193cef8d93c109' into clippyup
  • Loading branch information
flip1995 committed Oct 6, 2023
commit 8ebed4cc1a2e21844c58f3b0bfbad1a069bb09b6
97 changes: 95 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,101 @@ document.

## Unreleased / Beta / In Rust Nightly

[37f4c172...master](https://github.com/rust-lang/rust-clippy/compare/37f4c172...master)
[1e8fdf49...master](https://github.com/rust-lang/rust-clippy/compare/1e8fdf49...master)

## Rust 1.73

Current stable, released 2023-10-05

[View all 103 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2023-07-02T12%3A24%3A40Z..2023-08-11T11%3A09%3A56Z+base%3Amaster)

### New Lints

* [`impossible_comparisons`]
[#10843](https://github.com/rust-lang/rust-clippy/pull/10843)
* [`redundant_comparisons`]
[#10843](https://github.com/rust-lang/rust-clippy/pull/10843)
* [`ignored_unit_patterns`]
[#11242](https://github.com/rust-lang/rust-clippy/pull/11242)
* [`readonly_write_lock`]
[#11210](https://github.com/rust-lang/rust-clippy/pull/11210)
* [`filter_map_bool_then`]
[#11115](https://github.com/rust-lang/rust-clippy/pull/11115)
* [`needless_return_with_question_mark`]
[#11031](https://github.com/rust-lang/rust-clippy/pull/11031)
* [`redundant_guards`]
[#10955](https://github.com/rust-lang/rust-clippy/pull/10955)
* [`redundant_locals`]
[#10885](https://github.com/rust-lang/rust-clippy/pull/10885)
* [`absolute_paths`]
[#11003](https://github.com/rust-lang/rust-clippy/pull/11003)
* [`error_impl_error`]
[#11107](https://github.com/rust-lang/rust-clippy/pull/11107)
* [`iter_skip_zero`]
[#11046](https://github.com/rust-lang/rust-clippy/pull/11046)
* [`string_lit_chars_any`]
[#11052](https://github.com/rust-lang/rust-clippy/pull/11052)
* [`four_forward_slashes`]
[#11140](https://github.com/rust-lang/rust-clippy/pull/11140)
* [`format_collect`]
[#11116](https://github.com/rust-lang/rust-clippy/pull/11116)
* [`needless_pass_by_ref_mut`]
[#10900](https://github.com/rust-lang/rust-clippy/pull/10900)
* [`manual_is_infinite`]
[#11049](https://github.com/rust-lang/rust-clippy/pull/11049)
* [`manual_is_finite`]
[#11049](https://github.com/rust-lang/rust-clippy/pull/11049)
* [`incorrect_partial_ord_impl_on_ord_type`]
[#10788](https://github.com/rust-lang/rust-clippy/pull/10788)
* [`read_line_without_trim`]
[#10970](https://github.com/rust-lang/rust-clippy/pull/10970)
* [`type_id_on_box`]
[#10987](https://github.com/rust-lang/rust-clippy/pull/10987)

### Moves and Deprecations

* Renamed `unwrap_or_else_default` to [`unwrap_or_default`]
[#10120](https://github.com/rust-lang/rust-clippy/pull/10120)
* Moved [`tuple_array_conversions`] to `pedantic` (Now allow-by-default)
[#11146](https://github.com/rust-lang/rust-clippy/pull/11146)
* Moved [`arc_with_non_send_sync`] to `suspicious` (Now warn-by-default)
[#11104](https://github.com/rust-lang/rust-clippy/pull/11104)
* Moved [`needless_raw_string_hashes`] to `pedantic` (Now allow-by-default)
[#11415](https://github.com/rust-lang/rust-clippy/pull/11415)

### Enhancements

* [`unwrap_used`]: No longer lints on the never-type or never-like enums
[#11252](https://github.com/rust-lang/rust-clippy/pull/11252)
* [`expect_used`]: No longer lints on the never-type or never-like enums
[#11252](https://github.com/rust-lang/rust-clippy/pull/11252)

### False Positive Fixes

* [`panic_in_result_fn`]: No longer triggers on `todo!`, `unimplemented!`, `unreachable!`
[#11123](https://github.com/rust-lang/rust-clippy/pull/11123)

### Suggestion Fixes/Improvements

* [`semicolon_if_nothing_returned`]: The suggestion is now machine-applicable with rustfix
[#11083](https://github.com/rust-lang/rust-clippy/pull/11083)

### ICE Fixes

* [`filter_map_bool_then`]: No longer crashes on late-bound regions
[#11318](https://github.com/rust-lang/rust-clippy/pull/11318)
* [`unwrap_or_default`]: No longer crashes on alias types for local items
[#11258](https://github.com/rust-lang/rust-clippy/pull/11258)
* [`unnecessary_literal_unwrap`]: No longer crashes on `None.unwrap_or_default()`
[#11106](https://github.com/rust-lang/rust-clippy/pull/11106)
* Fixed MIR-related ICE
[#11130](https://github.com/rust-lang/rust-clippy/pull/11130)
* [`missing_fields_in_debug`]: No longer crashes on non-ADT self types
[#11069](https://github.com/rust-lang/rust-clippy/pull/11069)

## Rust 1.72

Current stable, released 2023-08-24
Released 2023-08-24

[View all 131 merged pull requests](https://github.com/rust-lang/rust-clippy/pulls?q=merged%3A2023-05-22T14%3A53%3A59Z..2023-07-01T22%3A57%3A20Z+base%3Amaster)

Expand Down Expand Up @@ -5011,6 +5101,7 @@ Released 2018-09-13
[`integer_division`]: https://rust-lang.github.io/rust-clippy/master/index.html#integer_division
[`into_iter_on_array`]: https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_array
[`into_iter_on_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
[`into_iter_without_iter`]: https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_without_iter
[`invalid_atomic_ordering`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_atomic_ordering
[`invalid_null_ptr_usage`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_null_ptr_usage
[`invalid_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#invalid_ref
Expand All @@ -5036,6 +5127,7 @@ Released 2018-09-13
[`iter_skip_next`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_skip_next
[`iter_skip_zero`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_skip_zero
[`iter_with_drain`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_with_drain
[`iter_without_into_iter`]: https://rust-lang.github.io/rust-clippy/master/index.html#iter_without_into_iter
[`iterator_step_by_zero`]: https://rust-lang.github.io/rust-clippy/master/index.html#iterator_step_by_zero
[`just_underscores_and_digits`]: https://rust-lang.github.io/rust-clippy/master/index.html#just_underscores_and_digits
[`large_const_arrays`]: https://rust-lang.github.io/rust-clippy/master/index.html#large_const_arrays
Expand Down Expand Up @@ -5072,6 +5164,7 @@ Released 2018-09-13
[`manual_find`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_find
[`manual_find_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_find_map
[`manual_flatten`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten
[`manual_hash_one`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_hash_one
[`manual_instant_elapsed`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_instant_elapsed
[`manual_is_ascii_check`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_ascii_check
[`manual_is_finite`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_finite
Expand Down
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy"
version = "0.1.74"
version = "0.1.75"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand All @@ -25,6 +25,8 @@ clippy_lints = { path = "clippy_lints" }
rustc_tools_util = "0.3.0"
tempfile = { version = "3.2", optional = true }
termize = "0.1"
color-print = "0.3.4" # Sync version with Cargo
anstream = "0.5.0"

[dev-dependencies]
ui_test = "0.20"
Expand Down
2 changes: 1 addition & 1 deletion book/src/development/adding_lints.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ impl EarlyLintPass for FooFunctions {}
[declare_clippy_lint]: https://github.com/rust-lang/rust-clippy/blob/557f6848bd5b7183f55c1e1522a326e9e1df6030/clippy_lints/src/lib.rs#L60
[example_lint_page]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints
[category_level_mapping]: https://github.com/rust-lang/rust-clippy/blob/557f6848bd5b7183f55c1e1522a326e9e1df6030/clippy_lints/src/lib.rs#L110
[category_level_mapping]: ../index.html

## Lint registration

Expand Down
1 change: 1 addition & 0 deletions book/src/lint_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ The minimum rust version that the project supports
* [`type_repetition_in_bounds`](https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds)
* [`tuple_array_conversions`](https://rust-lang.github.io/rust-clippy/master/index.html#tuple_array_conversions)
* [`manual_try_fold`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_try_fold)
* [`manual_hash_one`](https://rust-lang.github.io/rust-clippy/master/index.html#manual_hash_one)


## `cognitive-complexity-threshold`
Expand Down
63 changes: 51 additions & 12 deletions clippy_dev/src/new_lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub fn create(
};

create_lint(&lint, msrv).context("Unable to create lint implementation")?;
create_test(&lint).context("Unable to create a test for the new lint")?;
create_test(&lint, msrv).context("Unable to create a test for the new lint")?;

if lint.ty.is_none() {
add_lint(&lint, msrv).context("Unable to add lint to clippy_lints/src/lib.rs")?;
Expand Down Expand Up @@ -88,15 +88,21 @@ fn create_lint(lint: &LintData<'_>, enable_msrv: bool) -> io::Result<()> {
}
}

fn create_test(lint: &LintData<'_>) -> io::Result<()> {
fn create_project_layout<P: Into<PathBuf>>(lint_name: &str, location: P, case: &str, hint: &str) -> io::Result<()> {
fn create_test(lint: &LintData<'_>, msrv: bool) -> io::Result<()> {
fn create_project_layout<P: Into<PathBuf>>(
lint_name: &str,
location: P,
case: &str,
hint: &str,
msrv: bool,
) -> io::Result<()> {
let mut path = location.into().join(case);
fs::create_dir(&path)?;
write_file(path.join("Cargo.toml"), get_manifest_contents(lint_name, hint))?;

path.push("src");
fs::create_dir(&path)?;
write_file(path.join("main.rs"), get_test_file_contents(lint_name))?;
write_file(path.join("main.rs"), get_test_file_contents(lint_name, msrv))?;

Ok(())
}
Expand All @@ -106,13 +112,25 @@ fn create_test(lint: &LintData<'_>) -> io::Result<()> {
let test_dir = lint.project_root.join(&relative_test_dir);
fs::create_dir(&test_dir)?;

create_project_layout(lint.name, &test_dir, "fail", "Content that triggers the lint goes here")?;
create_project_layout(lint.name, &test_dir, "pass", "This file should not trigger the lint")?;
create_project_layout(
lint.name,
&test_dir,
"fail",
"Content that triggers the lint goes here",
msrv,
)?;
create_project_layout(
lint.name,
&test_dir,
"pass",
"This file should not trigger the lint",
false,
)?;

println!("Generated test directories: `{relative_test_dir}/pass`, `{relative_test_dir}/fail`");
} else {
let test_path = format!("tests/ui/{}.rs", lint.name);
let test_contents = get_test_file_contents(lint.name);
let test_contents = get_test_file_contents(lint.name, msrv);
write_file(lint.project_root.join(&test_path), test_contents)?;

println!("Generated test file: `{test_path}`");
Expand Down Expand Up @@ -194,16 +212,38 @@ pub(crate) fn get_stabilization_version() -> String {
parse_manifest(&contents).expect("Unable to find package version in `Cargo.toml`")
}

fn get_test_file_contents(lint_name: &str) -> String {
formatdoc!(
fn get_test_file_contents(lint_name: &str, msrv: bool) -> String {
let mut test = formatdoc!(
r#"
#![warn(clippy::{lint_name})]

fn main() {{
// test code goes here
}}
"#
)
);

if msrv {
let _ = writedoc!(
test,
r#"

// TODO: set xx to the version one below the MSRV used by the lint, and yy to
// the version used by the lint
#[clippy::msrv = "1.xx"]
fn msrv_1_xx() {{
// a simple example that would trigger the lint if the MSRV were met
}}

#[clippy::msrv = "1.yy"]
fn msrv_1_yy() {{
// the same example as above
}}
"#
);
}

test
}

fn get_manifest_contents(lint_name: &str, hint: &str) -> String {
Expand Down Expand Up @@ -258,7 +298,7 @@ fn get_lint_file_contents(lint: &LintData<'_>, enable_msrv: bool) -> String {
)
});

let _: fmt::Result = write!(result, "{}", get_lint_declaration(&name_upper, category));
let _: fmt::Result = writeln!(result, "{}", get_lint_declaration(&name_upper, category));

result.push_str(&if enable_msrv {
formatdoc!(
Expand All @@ -281,7 +321,6 @@ fn get_lint_file_contents(lint: &LintData<'_>, enable_msrv: bool) -> String {
}}

// TODO: Add MSRV level to `clippy_utils/src/msrvs.rs` if needed.
// TODO: Add MSRV test to `tests/ui/min_rust_version_attr.rs`.
// TODO: Update msrv config comment in `clippy_lints/src/utils/conf.rs`
"#
)
Expand Down
5 changes: 4 additions & 1 deletion clippy_lints/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clippy_lints"
version = "0.1.74"
version = "0.1.75"
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
repository = "https://github.com/rust-lang/rust-clippy"
readme = "README.md"
Expand Down Expand Up @@ -28,6 +28,9 @@ semver = "1.0"
rustc-semver = "1.1"
url = "2.2"

[dev-dependencies]
walkdir = "2.3"

[features]
deny-warnings = ["clippy_utils/deny-warnings"]
# build clippy with internal lints enabled, off by default
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/allow_attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use rustc_middle::lint::in_external_macro;
use rustc_session::{declare_lint_pass, declare_tool_lint};

declare_clippy_lint! {
/// ### What it does
/// Checks for usage of the `#[allow]` attribute and suggests replacing it with
/// the `#[expect]` (See [RFC 2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html))
///
Expand All @@ -19,7 +20,6 @@ declare_clippy_lint! {
/// (`#![allow]`) are usually used to enable or disable lints on a global scale.
///
/// ### Why is this bad?
///
/// `#[expect]` attributes suppress the lint emission, but emit a warning, if
/// the expectation is unfulfilled. This can be useful to be notified when the
/// lint is no longer triggered.
Expand Down
3 changes: 3 additions & 0 deletions clippy_lints/src/declared_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
crate::items_after_statements::ITEMS_AFTER_STATEMENTS_INFO,
crate::items_after_test_module::ITEMS_AFTER_TEST_MODULE_INFO,
crate::iter_not_returning_iterator::ITER_NOT_RETURNING_ITERATOR_INFO,
crate::iter_without_into_iter::INTO_ITER_WITHOUT_ITER_INFO,
crate::iter_without_into_iter::ITER_WITHOUT_INTO_ITER_INFO,
crate::large_const_arrays::LARGE_CONST_ARRAYS_INFO,
crate::large_enum_variant::LARGE_ENUM_VARIANT_INFO,
crate::large_futures::LARGE_FUTURES_INFO,
Expand Down Expand Up @@ -280,6 +282,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
crate::manual_clamp::MANUAL_CLAMP_INFO,
crate::manual_float_methods::MANUAL_IS_FINITE_INFO,
crate::manual_float_methods::MANUAL_IS_INFINITE_INFO,
crate::manual_hash_one::MANUAL_HASH_ONE_INFO,
crate::manual_is_ascii_check::MANUAL_IS_ASCII_CHECK_INFO,
crate::manual_let_else::MANUAL_LET_ELSE_INFO,
crate::manual_main_separator_str::MANUAL_MAIN_SEPARATOR_STR_INFO,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/enum_clike.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! lint on C-like enums that are `repr(isize/usize)` and have values that
//! don't fit into an `i32`

use clippy_utils::consts::{miri_to_const, Constant};
use clippy_utils::consts::{mir_to_const, Constant};
use clippy_utils::diagnostics::span_lint;
use rustc_hir::{Item, ItemKind};
use rustc_lint::{LateContext, LateLintPass};
Expand Down Expand Up @@ -51,7 +51,7 @@ impl<'tcx> LateLintPass<'tcx> for UnportableVariant {
.const_eval_poly(def_id.to_def_id())
.ok()
.map(|val| rustc_middle::mir::Const::from_value(val, ty));
if let Some(Constant::Int(val)) = constant.and_then(|c| miri_to_const(cx, c)) {
if let Some(Constant::Int(val)) = constant.and_then(|c| mir_to_const(cx, c)) {
if let ty::Adt(adt, _) = ty.kind() {
if adt.is_enum() {
ty = adt.repr().discr_type().to_ty(cx.tcx);
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/error_impl_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ declare_clippy_lint! {
///
/// impl std::error::Error for Error { ... }
/// ```
#[clippy::version = "1.72.0"]
#[clippy::version = "1.73.0"]
pub ERROR_IMPL_ERROR,
restriction,
"exported types named `Error` that implement `Error`"
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/four_forward_slashes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ declare_clippy_lint! {
/// // ...
/// }
/// ```
#[clippy::version = "1.72.0"]
#[clippy::version = "1.73.0"]
pub FOUR_FORWARD_SLASHES,
suspicious,
"comments with 4 forward slashes (`////`) likely intended to be doc comments (`///`)"
Expand Down
4 changes: 4 additions & 0 deletions clippy_lints/src/ignored_unit_patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ declare_lint_pass!(IgnoredUnitPatterns => [IGNORED_UNIT_PATTERNS]);

impl<'tcx> LateLintPass<'tcx> for IgnoredUnitPatterns {
fn check_pat(&mut self, cx: &LateContext<'tcx>, pat: &'tcx hir::Pat<'tcx>) {
if pat.span.from_expansion() {
return;
}

match cx.tcx.hir().get_parent(pat.hir_id) {
Node::Param(param) if matches!(cx.tcx.hir().get_parent(param.hir_id), Node::Item(_)) => {
// Ignore function parameters
Expand Down
Loading