mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
Remove #[allow]
s. Apply conversations from @Jarcho
This commit is contained in:
parent
8a2245dcb6
commit
6aa06b757d
17 changed files with 68 additions and 95 deletions
|
@ -11,27 +11,20 @@ pub(super) fn check_fn<'tcx>(cx: &LateContext<'_>, kind: &'tcx FnKind<'_>, body:
|
|||
{
|
||||
if let FnKind::ItemFn(ident, generics, _) = kind {
|
||||
for param in generics.params {
|
||||
if param.is_impl_trait()
|
||||
&& !param.name.ident().as_str().contains('<')
|
||||
&& !param.name.ident().as_str().contains('(')
|
||||
{
|
||||
if param.is_impl_trait() {
|
||||
// No generics with nested generics, and no generics like FnMut(x)
|
||||
span_lint_and_then(
|
||||
cx,
|
||||
IMPL_TRAIT_IN_PARAMS,
|
||||
param.span,
|
||||
&format!("'{}' in the function's parameters", param.name.ident().as_str()),
|
||||
"'`impl Trait` used as a function parameter'",
|
||||
|diag| {
|
||||
let next_letter = next_valid_letter(generics);
|
||||
if let Some(gen_span) = generics.span_for_param_suggestion() {
|
||||
diag.span_suggestion_with_style(
|
||||
gen_span,
|
||||
format!(
|
||||
"create a generic type here and replace that `{}` with `{}`",
|
||||
param.name.ident().as_str(),
|
||||
next_letter
|
||||
),
|
||||
", T: Trait",
|
||||
"add a type paremeter, `{}`: `{}`",
|
||||
format!(", {next_letter}: {}", ¶m.name.ident().as_str()[5..]),
|
||||
rustc_errors::Applicability::MaybeIncorrect,
|
||||
rustc_errors::SuggestionStyle::ShowAlways,
|
||||
);
|
||||
|
@ -46,12 +39,8 @@ pub(super) fn check_fn<'tcx>(cx: &LateContext<'_>, kind: &'tcx FnKind<'_>, body:
|
|||
ident.span.ctxt(),
|
||||
ident.span.parent(),
|
||||
),
|
||||
format!(
|
||||
"create a generic type here and replace that '{}' with `{}`",
|
||||
param.name.ident().as_str(),
|
||||
next_letter
|
||||
),
|
||||
"<T: Trait>",
|
||||
"add a type paremeter",
|
||||
format!("<{next_letter}: {}>", ¶m.name.ident().as_str()[5..]),
|
||||
rustc_errors::Applicability::MaybeIncorrect,
|
||||
rustc_errors::SuggestionStyle::ShowAlways,
|
||||
);
|
||||
|
|
|
@ -2,12 +2,7 @@
|
|||
//!
|
||||
//! - The `eq_foobar` functions test for semantic equality but ignores `NodeId`s and `Span`s.
|
||||
|
||||
#![allow(
|
||||
clippy::similar_names,
|
||||
clippy::wildcard_imports,
|
||||
clippy::enum_glob_use,
|
||||
clippy::impl_trait_in_params
|
||||
)]
|
||||
#![allow(clippy::similar_names, clippy::wildcard_imports, clippy::enum_glob_use)]
|
||||
|
||||
use crate::{both, over};
|
||||
use rustc_ast::ptr::P;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![allow(clippy::impl_trait_in_params)]
|
||||
//! This module handles checking if the span given is from a proc-macro or not.
|
||||
//!
|
||||
//! Proc-macros are capable of setting the span of every token they output to a few possible spans.
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![allow(clippy::impl_trait_in_params)]
|
||||
use crate::consts::constant_simple;
|
||||
use crate::macros::macro_backtrace;
|
||||
use crate::source::snippet_opt;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#![allow(clippy::similar_names, clippy::impl_trait_in_params)] // `expr` and `expn`
|
||||
#![allow(clippy::similar_names)] // `expr` and `expn`
|
||||
|
||||
use crate::source::snippet_opt;
|
||||
use crate::visitors::{for_each_expr, Descend};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//! Utils for extracting, inspecting or transforming source code
|
||||
|
||||
#![allow(clippy::module_name_repetitions, clippy::impl_trait_in_params)]
|
||||
#![allow(clippy::module_name_repetitions)]
|
||||
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::{Expr, ExprKind};
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
#![deny(clippy::borrowed_box)]
|
||||
#![allow(dead_code, unused_variables)]
|
||||
#![allow(
|
||||
clippy::uninlined_format_args,
|
||||
clippy::disallowed_names,
|
||||
clippy::impl_trait_in_params
|
||||
)]
|
||||
#![allow(clippy::uninlined_format_args, clippy::disallowed_names)]
|
||||
|
||||
use std::fmt::Display;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
|
||||
--> $DIR/borrow_box.rs:24:14
|
||||
--> $DIR/borrow_box.rs:20:14
|
||||
|
|
||||
LL | let foo: &Box<bool>;
|
||||
| ^^^^^^^^^^ help: try: `&bool`
|
||||
|
@ -11,55 +11,55 @@ LL | #![deny(clippy::borrowed_box)]
|
|||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
|
||||
--> $DIR/borrow_box.rs:28:10
|
||||
--> $DIR/borrow_box.rs:24:10
|
||||
|
|
||||
LL | foo: &'a Box<bool>,
|
||||
| ^^^^^^^^^^^^^ help: try: `&'a bool`
|
||||
|
||||
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
|
||||
--> $DIR/borrow_box.rs:32:17
|
||||
--> $DIR/borrow_box.rs:28:17
|
||||
|
|
||||
LL | fn test4(a: &Box<bool>);
|
||||
| ^^^^^^^^^^ help: try: `&bool`
|
||||
|
||||
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
|
||||
--> $DIR/borrow_box.rs:98:25
|
||||
--> $DIR/borrow_box.rs:94:25
|
||||
|
|
||||
LL | pub fn test14(_display: &Box<dyn Display>) {}
|
||||
| ^^^^^^^^^^^^^^^^^ help: try: `&dyn Display`
|
||||
|
||||
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
|
||||
--> $DIR/borrow_box.rs:99:25
|
||||
--> $DIR/borrow_box.rs:95:25
|
||||
|
|
||||
LL | pub fn test15(_display: &Box<dyn Display + Send>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(dyn Display + Send)`
|
||||
|
||||
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
|
||||
--> $DIR/borrow_box.rs:100:29
|
||||
--> $DIR/borrow_box.rs:96:29
|
||||
|
|
||||
LL | pub fn test16<'a>(_display: &'a Box<dyn Display + 'a>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&'a (dyn Display + 'a)`
|
||||
|
||||
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
|
||||
--> $DIR/borrow_box.rs:102:25
|
||||
--> $DIR/borrow_box.rs:98:25
|
||||
|
|
||||
LL | pub fn test17(_display: &Box<impl Display>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^ help: try: `&impl Display`
|
||||
|
||||
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
|
||||
--> $DIR/borrow_box.rs:103:25
|
||||
--> $DIR/borrow_box.rs:99:25
|
||||
|
|
||||
LL | pub fn test18(_display: &Box<impl Display + Send>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(impl Display + Send)`
|
||||
|
||||
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
|
||||
--> $DIR/borrow_box.rs:104:29
|
||||
--> $DIR/borrow_box.rs:100:29
|
||||
|
|
||||
LL | pub fn test19<'a>(_display: &'a Box<impl Display + 'a>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&'a (impl Display + 'a)`
|
||||
|
||||
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
|
||||
--> $DIR/borrow_box.rs:109:25
|
||||
--> $DIR/borrow_box.rs:105:25
|
||||
|
|
||||
LL | pub fn test20(_display: &Box<(dyn Display + Send)>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(dyn Display + Send)`
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
clippy::no_effect,
|
||||
clippy::option_map_unit_fn,
|
||||
clippy::redundant_closure_call,
|
||||
clippy::uninlined_format_args,
|
||||
clippy::impl_trait_in_params
|
||||
clippy::uninlined_format_args
|
||||
)]
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
clippy::no_effect,
|
||||
clippy::option_map_unit_fn,
|
||||
clippy::redundant_closure_call,
|
||||
clippy::uninlined_format_args,
|
||||
clippy::impl_trait_in_params
|
||||
clippy::uninlined_format_args
|
||||
)]
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: redundant closure
|
||||
--> $DIR/eta.rs:29:27
|
||||
--> $DIR/eta.rs:28:27
|
||||
|
|
||||
LL | let a = Some(1u8).map(|a| foo(a));
|
||||
| ^^^^^^^^^^ help: replace the closure with the function itself: `foo`
|
||||
|
@ -7,31 +7,31 @@ LL | let a = Some(1u8).map(|a| foo(a));
|
|||
= note: `-D clippy::redundant-closure` implied by `-D warnings`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:33:40
|
||||
--> $DIR/eta.rs:32:40
|
||||
|
|
||||
LL | let _: Option<Vec<u8>> = true.then(|| vec![]); // special case vec!
|
||||
| ^^^^^^^^^ help: replace the closure with `Vec::new`: `std::vec::Vec::new`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:34:35
|
||||
--> $DIR/eta.rs:33:35
|
||||
|
|
||||
LL | let d = Some(1u8).map(|a| foo((|b| foo2(b))(a))); //is adjusted?
|
||||
| ^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo2`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:35:26
|
||||
--> $DIR/eta.rs:34:26
|
||||
|
|
||||
LL | all(&[1, 2, 3], &&2, |x, y| below(x, y)); //is adjusted
|
||||
| ^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `below`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:42:27
|
||||
--> $DIR/eta.rs:41:27
|
||||
|
|
||||
LL | let e = Some(1u8).map(|a| generic(a));
|
||||
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `generic`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:88:51
|
||||
--> $DIR/eta.rs:87:51
|
||||
|
|
||||
LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
|
||||
| ^^^^^^^^^^^ help: replace the closure with the method itself: `TestStruct::foo`
|
||||
|
@ -39,121 +39,121 @@ LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.foo());
|
|||
= note: `-D clippy::redundant-closure-for-method-calls` implied by `-D warnings`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:89:51
|
||||
--> $DIR/eta.rs:88:51
|
||||
|
|
||||
LL | let e = Some(TestStruct { some_ref: &i }).map(|a| a.trait_foo());
|
||||
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `TestTrait::trait_foo`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:91:42
|
||||
--> $DIR/eta.rs:90:42
|
||||
|
|
||||
LL | let e = Some(&mut vec![1, 2, 3]).map(|v| v.clear());
|
||||
| ^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::vec::Vec::clear`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:95:29
|
||||
--> $DIR/eta.rs:94:29
|
||||
|
|
||||
LL | let e = Some("str").map(|s| s.to_string());
|
||||
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::string::ToString::to_string`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:96:27
|
||||
--> $DIR/eta.rs:95:27
|
||||
|
|
||||
LL | let e = Some('a').map(|s| s.to_uppercase());
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_uppercase`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:98:65
|
||||
--> $DIR/eta.rs:97:65
|
||||
|
|
||||
LL | let e: std::vec::Vec<char> = vec!['a', 'b', 'c'].iter().map(|c| c.to_ascii_uppercase()).collect();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `char::to_ascii_uppercase`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:161:22
|
||||
--> $DIR/eta.rs:160:22
|
||||
|
|
||||
LL | requires_fn_once(|| x());
|
||||
| ^^^^^^ help: replace the closure with the function itself: `x`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:168:27
|
||||
--> $DIR/eta.rs:167:27
|
||||
|
|
||||
LL | let a = Some(1u8).map(|a| foo_ptr(a));
|
||||
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `foo_ptr`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:173:27
|
||||
--> $DIR/eta.rs:172:27
|
||||
|
|
||||
LL | let a = Some(1u8).map(|a| closure(a));
|
||||
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `closure`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:205:28
|
||||
--> $DIR/eta.rs:204:28
|
||||
|
|
||||
LL | x.into_iter().for_each(|x| add_to_res(x));
|
||||
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:206:28
|
||||
--> $DIR/eta.rs:205:28
|
||||
|
|
||||
LL | y.into_iter().for_each(|x| add_to_res(x));
|
||||
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut add_to_res`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:207:28
|
||||
--> $DIR/eta.rs:206:28
|
||||
|
|
||||
LL | z.into_iter().for_each(|x| add_to_res(x));
|
||||
| ^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `add_to_res`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:214:21
|
||||
--> $DIR/eta.rs:213:21
|
||||
|
|
||||
LL | Some(1).map(|n| closure(n));
|
||||
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut closure`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:218:21
|
||||
--> $DIR/eta.rs:217:21
|
||||
|
|
||||
LL | Some(1).map(|n| in_loop(n));
|
||||
| ^^^^^^^^^^^^^^ help: replace the closure with the function itself: `in_loop`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:311:18
|
||||
--> $DIR/eta.rs:310:18
|
||||
|
|
||||
LL | takes_fn_mut(|| f());
|
||||
| ^^^^^^ help: replace the closure with the function itself: `&mut f`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:314:19
|
||||
--> $DIR/eta.rs:313:19
|
||||
|
|
||||
LL | takes_fn_once(|| f());
|
||||
| ^^^^^^ help: replace the closure with the function itself: `&mut f`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:318:26
|
||||
--> $DIR/eta.rs:317:26
|
||||
|
|
||||
LL | move || takes_fn_mut(|| f_used_once())
|
||||
| ^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `&mut f_used_once`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:330:19
|
||||
--> $DIR/eta.rs:329:19
|
||||
|
|
||||
LL | array_opt.map(|a| a.as_slice());
|
||||
| ^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<[u8; 3]>::as_slice`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:333:19
|
||||
--> $DIR/eta.rs:332:19
|
||||
|
|
||||
LL | slice_opt.map(|s| s.len());
|
||||
| ^^^^^^^^^^^ help: replace the closure with the method itself: `<[u8]>::len`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:336:17
|
||||
--> $DIR/eta.rs:335:17
|
||||
|
|
||||
LL | ptr_opt.map(|p| p.is_null());
|
||||
| ^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<*const usize>::is_null`
|
||||
|
||||
error: redundant closure
|
||||
--> $DIR/eta.rs:340:17
|
||||
--> $DIR/eta.rs:339:17
|
||||
|
|
||||
LL | dyn_opt.map(|d| d.method_on_dyn());
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `<dyn TestTrait>::method_on_dyn`
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
error: 'impl Trait' in the function's parameters
|
||||
error: '`impl Trait` used as a function parameter'
|
||||
--> $DIR/impl_trait_in_params.rs:8:13
|
||||
|
|
||||
LL | pub fn a(_: impl Trait) {}
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
= note: `-D clippy::impl-trait-in-params` implied by `-D warnings`
|
||||
help: create a generic type here and replace that 'impl Trait' with `T`
|
||||
help: add a type paremeter
|
||||
|
|
||||
LL | pub fn a<T: Trait>(_: impl Trait) {}
|
||||
| ++++++++++
|
||||
|
||||
error: 'impl Trait' in the function's parameters
|
||||
error: '`impl Trait` used as a function parameter'
|
||||
--> $DIR/impl_trait_in_params.rs:9:29
|
||||
|
|
||||
LL | pub fn c<C: Trait>(_: C, _: impl Trait) {}
|
||||
| ^^^^^^^^^^
|
||||
|
|
||||
help: create a generic type here and replace that `impl Trait` with `T`
|
||||
help: add a type paremeter, `{}`: `{}`
|
||||
|
|
||||
LL | pub fn c<C: Trait, T: Trait>(_: C, _: impl Trait) {}
|
||||
| ++++++++++
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// run-rustfix
|
||||
#![deny(clippy::trait_duplication_in_bounds)]
|
||||
#![allow(clippy::impl_trait_in_params)]
|
||||
#![allow(unused)]
|
||||
|
||||
fn bad_foo<T: Clone + Copy, U: Clone + Copy>(arg0: T, argo1: U) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
// run-rustfix
|
||||
#![deny(clippy::trait_duplication_in_bounds)]
|
||||
#![allow(clippy::impl_trait_in_params)]
|
||||
#![allow(unused)]
|
||||
|
||||
fn bad_foo<T: Clone + Clone + Clone + Copy, U: Clone + Copy>(arg0: T, argo1: U) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: these bounds contain repeated elements
|
||||
--> $DIR/trait_duplication_in_bounds.rs:6:15
|
||||
--> $DIR/trait_duplication_in_bounds.rs:5:15
|
||||
|
|
||||
LL | fn bad_foo<T: Clone + Clone + Clone + Copy, U: Clone + Copy>(arg0: T, argo1: U) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + Copy`
|
||||
|
@ -11,43 +11,43 @@ LL | #![deny(clippy::trait_duplication_in_bounds)]
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: these where clauses contain repeated elements
|
||||
--> $DIR/trait_duplication_in_bounds.rs:12:8
|
||||
--> $DIR/trait_duplication_in_bounds.rs:11:8
|
||||
|
|
||||
LL | T: Clone + Clone + Clone + Copy,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + Copy`
|
||||
|
||||
error: these bounds contain repeated elements
|
||||
--> $DIR/trait_duplication_in_bounds.rs:40:26
|
||||
--> $DIR/trait_duplication_in_bounds.rs:39:26
|
||||
|
|
||||
LL | trait BadSelfTraitBound: Clone + Clone + Clone {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone`
|
||||
|
||||
error: these where clauses contain repeated elements
|
||||
--> $DIR/trait_duplication_in_bounds.rs:47:15
|
||||
--> $DIR/trait_duplication_in_bounds.rs:46:15
|
||||
|
|
||||
LL | Self: Clone + Clone + Clone;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone`
|
||||
|
||||
error: these bounds contain repeated elements
|
||||
--> $DIR/trait_duplication_in_bounds.rs:61:24
|
||||
--> $DIR/trait_duplication_in_bounds.rs:60:24
|
||||
|
|
||||
LL | trait BadTraitBound<T: Clone + Clone + Clone + Copy, U: Clone + Copy> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + Copy`
|
||||
|
||||
error: these where clauses contain repeated elements
|
||||
--> $DIR/trait_duplication_in_bounds.rs:68:12
|
||||
--> $DIR/trait_duplication_in_bounds.rs:67:12
|
||||
|
|
||||
LL | T: Clone + Clone + Clone + Copy,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Clone + Copy`
|
||||
|
||||
error: these bounds contain repeated elements
|
||||
--> $DIR/trait_duplication_in_bounds.rs:101:19
|
||||
--> $DIR/trait_duplication_in_bounds.rs:100:19
|
||||
|
|
||||
LL | fn bad_generic<T: GenericTrait<u64> + GenericTrait<u32> + GenericTrait<u64>>(arg0: T) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `GenericTrait<u64> + GenericTrait<u32>`
|
||||
|
||||
error: these bounds contain repeated elements
|
||||
--> $DIR/trait_duplication_in_bounds.rs:109:22
|
||||
--> $DIR/trait_duplication_in_bounds.rs:108:22
|
||||
|
|
||||
LL | fn qualified_path<T: std::clone::Clone + Clone + foo::Clone>(arg0: T) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::clone::Clone + foo::Clone`
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#![deny(clippy::trait_duplication_in_bounds)]
|
||||
#![allow(clippy::impl_trait_in_params)]
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: this trait bound is already specified in the where clause
|
||||
--> $DIR/trait_duplication_in_bounds_unfixable.rs:7:15
|
||||
--> $DIR/trait_duplication_in_bounds_unfixable.rs:6:15
|
||||
|
|
||||
LL | fn bad_foo<T: Clone + Default, Z: Copy>(arg0: T, arg1: Z)
|
||||
| ^^^^^
|
||||
|
@ -12,7 +12,7 @@ LL | #![deny(clippy::trait_duplication_in_bounds)]
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this trait bound is already specified in the where clause
|
||||
--> $DIR/trait_duplication_in_bounds_unfixable.rs:7:23
|
||||
--> $DIR/trait_duplication_in_bounds_unfixable.rs:6:23
|
||||
|
|
||||
LL | fn bad_foo<T: Clone + Default, Z: Copy>(arg0: T, arg1: Z)
|
||||
| ^^^^^^^
|
||||
|
@ -20,7 +20,7 @@ LL | fn bad_foo<T: Clone + Default, Z: Copy>(arg0: T, arg1: Z)
|
|||
= help: consider removing this trait bound
|
||||
|
||||
error: this trait bound is already specified in trait declaration
|
||||
--> $DIR/trait_duplication_in_bounds_unfixable.rs:36:15
|
||||
--> $DIR/trait_duplication_in_bounds_unfixable.rs:35:15
|
||||
|
|
||||
LL | Self: Default;
|
||||
| ^^^^^^^
|
||||
|
@ -28,7 +28,7 @@ LL | Self: Default;
|
|||
= help: consider removing this trait bound
|
||||
|
||||
error: this trait bound is already specified in trait declaration
|
||||
--> $DIR/trait_duplication_in_bounds_unfixable.rs:50:15
|
||||
--> $DIR/trait_duplication_in_bounds_unfixable.rs:49:15
|
||||
|
|
||||
LL | Self: Default + Clone;
|
||||
| ^^^^^^^
|
||||
|
@ -36,7 +36,7 @@ LL | Self: Default + Clone;
|
|||
= help: consider removing this trait bound
|
||||
|
||||
error: this trait bound is already specified in trait declaration
|
||||
--> $DIR/trait_duplication_in_bounds_unfixable.rs:56:15
|
||||
--> $DIR/trait_duplication_in_bounds_unfixable.rs:55:15
|
||||
|
|
||||
LL | Self: Default + Clone;
|
||||
| ^^^^^^^
|
||||
|
@ -44,7 +44,7 @@ LL | Self: Default + Clone;
|
|||
= help: consider removing this trait bound
|
||||
|
||||
error: this trait bound is already specified in trait declaration
|
||||
--> $DIR/trait_duplication_in_bounds_unfixable.rs:56:25
|
||||
--> $DIR/trait_duplication_in_bounds_unfixable.rs:55:25
|
||||
|
|
||||
LL | Self: Default + Clone;
|
||||
| ^^^^^
|
||||
|
@ -52,7 +52,7 @@ LL | Self: Default + Clone;
|
|||
= help: consider removing this trait bound
|
||||
|
||||
error: this trait bound is already specified in trait declaration
|
||||
--> $DIR/trait_duplication_in_bounds_unfixable.rs:59:15
|
||||
--> $DIR/trait_duplication_in_bounds_unfixable.rs:58:15
|
||||
|
|
||||
LL | Self: Default;
|
||||
| ^^^^^^^
|
||||
|
@ -60,7 +60,7 @@ LL | Self: Default;
|
|||
= help: consider removing this trait bound
|
||||
|
||||
error: this trait bound is already specified in trait declaration
|
||||
--> $DIR/trait_duplication_in_bounds_unfixable.rs:94:15
|
||||
--> $DIR/trait_duplication_in_bounds_unfixable.rs:93:15
|
||||
|
|
||||
LL | Self: Iterator<Item = Foo>,
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
Loading…
Reference in a new issue