Skip to content

Commit 942d2ac

Browse files
committed
Tests pass
1 parent 9aed535 commit 942d2ac

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

clippy_lints/src/functions/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ declare_clippy_lint! {
343343
/// Use instead:
344344
/// ```rust
345345
/// trait MyTrait {}
346-
/// fn foo<T: A>(a: A) {
346+
/// fn foo<T: MyTrait>(a: T) {
347347
/// // [...]
348348
/// }
349349
/// ```

tests/ui/borrow_box.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
2-
--> $DIR/borrow_box.rs:20:14
2+
--> $DIR/borrow_box.rs:24:14
33
|
44
LL | let foo: &Box<bool>;
55
| ^^^^^^^^^^ help: try: `&bool`
@@ -11,55 +11,55 @@ LL | #![deny(clippy::borrowed_box)]
1111
| ^^^^^^^^^^^^^^^^^^^^
1212

1313
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
14-
--> $DIR/borrow_box.rs:24:10
14+
--> $DIR/borrow_box.rs:28:10
1515
|
1616
LL | foo: &'a Box<bool>,
1717
| ^^^^^^^^^^^^^ help: try: `&'a bool`
1818

1919
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
20-
--> $DIR/borrow_box.rs:28:17
20+
--> $DIR/borrow_box.rs:32:17
2121
|
2222
LL | fn test4(a: &Box<bool>);
2323
| ^^^^^^^^^^ help: try: `&bool`
2424

2525
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
26-
--> $DIR/borrow_box.rs:94:25
26+
--> $DIR/borrow_box.rs:98:25
2727
|
2828
LL | pub fn test14(_display: &Box<dyn Display>) {}
2929
| ^^^^^^^^^^^^^^^^^ help: try: `&dyn Display`
3030

3131
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
32-
--> $DIR/borrow_box.rs:95:25
32+
--> $DIR/borrow_box.rs:99:25
3333
|
3434
LL | pub fn test15(_display: &Box<dyn Display + Send>) {}
3535
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(dyn Display + Send)`
3636

3737
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
38-
--> $DIR/borrow_box.rs:96:29
38+
--> $DIR/borrow_box.rs:100:29
3939
|
4040
LL | pub fn test16<'a>(_display: &'a Box<dyn Display + 'a>) {}
4141
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&'a (dyn Display + 'a)`
4242

4343
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
44-
--> $DIR/borrow_box.rs:98:25
44+
--> $DIR/borrow_box.rs:102:25
4545
|
4646
LL | pub fn test17(_display: &Box<impl Display>) {}
4747
| ^^^^^^^^^^^^^^^^^^ help: try: `&impl Display`
4848

4949
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
50-
--> $DIR/borrow_box.rs:99:25
50+
--> $DIR/borrow_box.rs:103:25
5151
|
5252
LL | pub fn test18(_display: &Box<impl Display + Send>) {}
5353
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(impl Display + Send)`
5454

5555
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
56-
--> $DIR/borrow_box.rs:100:29
56+
--> $DIR/borrow_box.rs:104:29
5757
|
5858
LL | pub fn test19<'a>(_display: &'a Box<impl Display + 'a>) {}
5959
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&'a (impl Display + 'a)`
6060

6161
error: you seem to be trying to use `&Box<T>`. Consider using just `&T`
62-
--> $DIR/borrow_box.rs:105:25
62+
--> $DIR/borrow_box.rs:109:25
6363
|
6464
LL | pub fn test20(_display: &Box<(dyn Display + Send)>) {}
6565
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&(dyn Display + Send)`

tests/ui/impl_trait_in_params.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
#![warn(clippy::impl_trait_in_params)]
33

44
pub trait Trait {}
5+
pub trait AnotherTrait<T> {}
56

67
// Should warn
78
pub fn a(_: impl Trait) {}
89
pub fn c<C: Trait>(_: C, _: impl Trait) {}
10+
fn d(_: impl AnotherTrait<u32>) {}
911

1012
// Shouldn't warn
1113

1214
pub fn b<B: Trait>(_: B) {}
13-
fn d<D: Trait>(_: D, _: impl Trait) {}
15+
fn e<T: AnotherTrait<u32>>(_: T) {}
1416

1517
fn main() {}

tests/ui/impl_trait_in_params.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error: 'impl Trait' in the function's parameters
2-
--> $DIR/impl_trait_param.rs:7:13
2+
--> $DIR/impl_trait_in_params.rs:8:13
33
|
44
LL | pub fn a(_: impl Trait) {}
55
| ^^^^^^^^^^
66
|
7-
= note: `-D clippy::impl-trait-param` implied by `-D warnings`
7+
= note: `-D clippy::impl-trait-in-params` implied by `-D warnings`
88
help: create a generic type here and replace that 'impl Trait' with `T`
99
|
1010
LL | pub fn a<T: Trait>(_: impl Trait) {}
1111
| ++++++++++
1212

1313
error: 'impl Trait' in the function's parameters
14-
--> $DIR/impl_trait_param.rs:8:29
14+
--> $DIR/impl_trait_in_params.rs:9:29
1515
|
1616
LL | pub fn c<C: Trait>(_: C, _: impl Trait) {}
1717
| ^^^^^^^^^^

0 commit comments

Comments
 (0)