Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 2 additions & 20 deletions tests/ui/methods.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
//@aux-build:option_helpers.rs

#![allow(
clippy::disallowed_names,
clippy::default_trait_access,
clippy::let_underscore_untyped,
clippy::missing_docs_in_private_items,
clippy::missing_safety_doc,
clippy::non_ascii_literal,
clippy::new_without_default,
clippy::needless_pass_by_value,
clippy::needless_lifetimes,
clippy::elidable_lifetime_names,
clippy::print_stdout,
clippy::must_use_candidate,
clippy::use_self,
clippy::useless_format,
clippy::wrong_self_convention,
clippy::unused_async,
clippy::unused_self,
clippy::useless_vec
)]
#![warn(clippy::filter_next, clippy::new_ret_no_self)]
#![expect(clippy::disallowed_names, clippy::useless_vec)]

#[macro_use]
extern crate option_helpers;
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/methods.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: methods called `new` usually return `Self`
--> tests/ui/methods.rs:102:5
--> tests/ui/methods.rs:84:5
|
LL | / fn new() -> i32 {
LL | |
Expand All @@ -11,7 +11,7 @@ LL | | }
= help: to override `-D warnings` add `#[allow(clippy::new_ret_no_self)]`

error: called `filter(..).next()` on an `Iterator`. This is more succinctly expressed by calling `.find(..)` instead
--> tests/ui/methods.rs:124:13
--> tests/ui/methods.rs:106:13
|
LL | let _ = v.iter().filter(|&x| {
| _____________^
Expand All @@ -25,7 +25,7 @@ LL | | ).next();
= help: to override `-D warnings` add `#[allow(clippy::filter_next)]`

error: called `filter(..).next_back()` on an `DoubleEndedIterator`. This is more succinctly expressed by calling `.rfind(..)` instead
--> tests/ui/methods.rs:143:13
--> tests/ui/methods.rs:125:13
|
LL | let _ = v.iter().filter(|&x| {
| _____________^
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/methods_fixable.fixed
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![warn(clippy::filter_next)]
#![allow(clippy::useless_vec)]
#![expect(clippy::useless_vec)]

/// Checks implementation of `FILTER_NEXT` lint.
fn main() {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/methods_fixable.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![warn(clippy::filter_next)]
#![allow(clippy::useless_vec)]
#![expect(clippy::useless_vec)]

/// Checks implementation of `FILTER_NEXT` lint.
fn main() {
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/min_ident_chars.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//@aux-build:proc_macros.rs
#![allow(irrefutable_let_patterns, nonstandard_style, unused)]
#![allow(clippy::struct_field_names)]
#![warn(clippy::min_ident_chars)]
#![expect(irrefutable_let_patterns, nonstandard_style)]
#![allow(clippy::struct_field_names)]

extern crate proc_macros;
use proc_macros::{external, with_span};
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/min_max.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(clippy::manual_clamp)]
#![warn(clippy::min_max)]
#![expect(clippy::manual_clamp)]

use std::cmp::{max as my_max, max, min as my_min, min};

Expand Down
29 changes: 15 additions & 14 deletions tests/ui/min_max.stderr
Original file line number Diff line number Diff line change
@@ -1,79 +1,80 @@
error: this `min`/`max` combination leads to constant result
--> tests/ui/min_max.rs:21:5
--> tests/ui/min_max.rs:22:5
|
LL | min(1, max(3, x));
| ^^^^^^^^^^^^^^^^^
|
= note: `#[deny(clippy::min_max)]` on by default
= note: `-D clippy::min-max` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::min_max)]`

error: this `min`/`max` combination leads to constant result
--> tests/ui/min_max.rs:24:5
--> tests/ui/min_max.rs:25:5
|
LL | min(max(3, x), 1);
| ^^^^^^^^^^^^^^^^^

error: this `min`/`max` combination leads to constant result
--> tests/ui/min_max.rs:27:5
--> tests/ui/min_max.rs:28:5
|
LL | max(min(x, 1), 3);
| ^^^^^^^^^^^^^^^^^

error: this `min`/`max` combination leads to constant result
--> tests/ui/min_max.rs:30:5
--> tests/ui/min_max.rs:31:5
|
LL | max(3, min(x, 1));
| ^^^^^^^^^^^^^^^^^

error: this `min`/`max` combination leads to constant result
--> tests/ui/min_max.rs:33:5
--> tests/ui/min_max.rs:34:5
|
LL | my_max(3, my_min(x, 1));
| ^^^^^^^^^^^^^^^^^^^^^^^

error: this `min`/`max` combination leads to constant result
--> tests/ui/min_max.rs:44:5
--> tests/ui/min_max.rs:45:5
|
LL | min("Apple", max("Zoo", s));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: this `min`/`max` combination leads to constant result
--> tests/ui/min_max.rs:47:5
--> tests/ui/min_max.rs:48:5
|
LL | max(min(s, "Apple"), "Zoo");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: this `min`/`max` combination leads to constant result
--> tests/ui/min_max.rs:53:5
--> tests/ui/min_max.rs:54:5
|
LL | x.min(1).max(3);
| ^^^^^^^^^^^^^^^

error: this `min`/`max` combination leads to constant result
--> tests/ui/min_max.rs:56:5
--> tests/ui/min_max.rs:57:5
|
LL | x.max(3).min(1);
| ^^^^^^^^^^^^^^^

error: this `min`/`max` combination leads to constant result
--> tests/ui/min_max.rs:59:5
--> tests/ui/min_max.rs:60:5
|
LL | f.max(3f32).min(1f32);
| ^^^^^^^^^^^^^^^^^^^^^

error: this `min`/`max` combination leads to constant result
--> tests/ui/min_max.rs:66:5
--> tests/ui/min_max.rs:67:5
|
LL | max(x.min(1), 3);
| ^^^^^^^^^^^^^^^^

error: this `min`/`max` combination leads to constant result
--> tests/ui/min_max.rs:71:5
--> tests/ui/min_max.rs:72:5
|
LL | s.max("Zoo").min("Apple");
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error: this `min`/`max` combination leads to constant result
--> tests/ui/min_max.rs:74:5
--> tests/ui/min_max.rs:75:5
|
LL | s.min("Apple").max("Zoo");
| ^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
1 change: 0 additions & 1 deletion tests/ui/min_rust_version_attr.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![allow(clippy::redundant_clone)]
#![feature(custom_inner_attributes)]

fn main() {}
Expand Down
12 changes: 6 additions & 6 deletions tests/ui/min_rust_version_attr.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: approximate value of `f{32, 64}::consts::LOG2_10` found
--> tests/ui/min_rust_version_attr.rs:13:19
--> tests/ui/min_rust_version_attr.rs:12:19
|
LL | let log2_10 = 3.321928094887362;
| ^^^^^^^^^^^^^^^^^
Expand All @@ -8,39 +8,39 @@ LL | let log2_10 = 3.321928094887362;
= note: `#[deny(clippy::approx_constant)]` on by default

error: approximate value of `f{32, 64}::consts::LOG2_10` found
--> tests/ui/min_rust_version_attr.rs:19:19
--> tests/ui/min_rust_version_attr.rs:18:19
|
LL | let log2_10 = 3.321928094887362;
| ^^^^^^^^^^^^^^^^^
|
= help: consider using the constant directly

error: approximate value of `f{32, 64}::consts::LOG2_10` found
--> tests/ui/min_rust_version_attr.rs:30:19
--> tests/ui/min_rust_version_attr.rs:29:19
|
LL | let log2_10 = 3.321928094887362;
| ^^^^^^^^^^^^^^^^^
|
= help: consider using the constant directly

error: approximate value of `f{32, 64}::consts::LOG2_10` found
--> tests/ui/min_rust_version_attr.rs:41:19
--> tests/ui/min_rust_version_attr.rs:40:19
|
LL | let log2_10 = 3.321928094887362;
| ^^^^^^^^^^^^^^^^^
|
= help: consider using the constant directly

error: approximate value of `f{32, 64}::consts::LOG2_10` found
--> tests/ui/min_rust_version_attr.rs:52:19
--> tests/ui/min_rust_version_attr.rs:51:19
|
LL | let log2_10 = 3.321928094887362;
| ^^^^^^^^^^^^^^^^^
|
= help: consider using the constant directly

error: approximate value of `f{32, 64}::consts::LOG2_10` found
--> tests/ui/min_rust_version_attr.rs:60:27
--> tests/ui/min_rust_version_attr.rs:59:27
|
LL | let log2_10 = 3.321928094887362;
| ^^^^^^^^^^^^^^^^^
Expand Down
1 change: 0 additions & 1 deletion tests/ui/mismatching_type_param_order.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![warn(clippy::mismatching_type_param_order)]
#![allow(clippy::disallowed_names, clippy::needless_lifetimes)]

fn main() {
struct Foo<A, B> {
Expand Down
20 changes: 10 additions & 10 deletions tests/ui/mismatching_type_param_order.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: `Foo` has a similarly named generic type parameter `B` in its declaration, but in a different order
--> tests/ui/mismatching_type_param_order.rs:11:20
--> tests/ui/mismatching_type_param_order.rs:10:20
|
LL | impl<B, A> Foo<B, A> {}
| ^
Expand All @@ -9,71 +9,71 @@ LL | impl<B, A> Foo<B, A> {}
= help: to override `-D warnings` add `#[allow(clippy::mismatching_type_param_order)]`

error: `Foo` has a similarly named generic type parameter `A` in its declaration, but in a different order
--> tests/ui/mismatching_type_param_order.rs:11:23
--> tests/ui/mismatching_type_param_order.rs:10:23
|
LL | impl<B, A> Foo<B, A> {}
| ^
|
= help: try `B`, or a name that does not conflict with `Foo`'s generic params

error: `Foo` has a similarly named generic type parameter `A` in its declaration, but in a different order
--> tests/ui/mismatching_type_param_order.rs:16:23
--> tests/ui/mismatching_type_param_order.rs:15:23
|
LL | impl<C, A> Foo<C, A> {}
| ^
|
= help: try `B`, or a name that does not conflict with `Foo`'s generic params

error: `FooLifetime` has a similarly named generic type parameter `B` in its declaration, but in a different order
--> tests/ui/mismatching_type_param_order.rs:28:44
--> tests/ui/mismatching_type_param_order.rs:27:44
|
LL | impl<'m, 'l, B, A> FooLifetime<'m, 'l, B, A> {}
| ^
|
= help: try `A`, or a name that does not conflict with `FooLifetime`'s generic params

error: `FooLifetime` has a similarly named generic type parameter `A` in its declaration, but in a different order
--> tests/ui/mismatching_type_param_order.rs:28:47
--> tests/ui/mismatching_type_param_order.rs:27:47
|
LL | impl<'m, 'l, B, A> FooLifetime<'m, 'l, B, A> {}
| ^
|
= help: try `B`, or a name that does not conflict with `FooLifetime`'s generic params

error: `FooEnum` has a similarly named generic type parameter `C` in its declaration, but in a different order
--> tests/ui/mismatching_type_param_order.rs:46:27
--> tests/ui/mismatching_type_param_order.rs:45:27
|
LL | impl<C, A, B> FooEnum<C, A, B> {}
| ^
|
= help: try `A`, or a name that does not conflict with `FooEnum`'s generic params

error: `FooEnum` has a similarly named generic type parameter `A` in its declaration, but in a different order
--> tests/ui/mismatching_type_param_order.rs:46:30
--> tests/ui/mismatching_type_param_order.rs:45:30
|
LL | impl<C, A, B> FooEnum<C, A, B> {}
| ^
|
= help: try `B`, or a name that does not conflict with `FooEnum`'s generic params

error: `FooEnum` has a similarly named generic type parameter `B` in its declaration, but in a different order
--> tests/ui/mismatching_type_param_order.rs:46:33
--> tests/ui/mismatching_type_param_order.rs:45:33
|
LL | impl<C, A, B> FooEnum<C, A, B> {}
| ^
|
= help: try `C`, or a name that does not conflict with `FooEnum`'s generic params

error: `FooUnion` has a similarly named generic type parameter `B` in its declaration, but in a different order
--> tests/ui/mismatching_type_param_order.rs:60:31
--> tests/ui/mismatching_type_param_order.rs:59:31
|
LL | impl<B: Copy, A> FooUnion<B, A> where A: Copy {}
| ^
|
= help: try `A`, or a name that does not conflict with `FooUnion`'s generic params

error: `FooUnion` has a similarly named generic type parameter `A` in its declaration, but in a different order
--> tests/ui/mismatching_type_param_order.rs:60:34
--> tests/ui/mismatching_type_param_order.rs:59:34
|
LL | impl<B: Copy, A> FooUnion<B, A> where A: Copy {}
| ^
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/misnamed_getters.fixed
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![allow(unused)]
#![allow(clippy::struct_field_names)]
#![warn(clippy::misnamed_getters)]
#![expect(clippy::struct_field_names)]

struct A {
a: u8,
Expand Down
3 changes: 1 addition & 2 deletions tests/ui/misnamed_getters.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![allow(unused)]
#![allow(clippy::struct_field_names)]
#![warn(clippy::misnamed_getters)]
#![expect(clippy::struct_field_names)]

struct A {
a: u8,
Expand Down
Loading