Skip to content

Commit c6f8d02

Browse files
committed
Allow newly added non_local_definitions lint in clippy
1 parent 9b82bdd commit c6f8d02

8 files changed

+24
-17
lines changed

src/tools/clippy/tests/ui/crashes/ice-4760.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(non_local_definitions)]
2+
13
const COUNT: usize = 2;
24
struct Thing;
35
trait Dummy {}

src/tools/clippy/tests/ui/crashes/ice-6179.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
#![warn(clippy::use_self)]
55
#![allow(dead_code, clippy::let_with_type_underscore)]
6+
#![allow(non_local_definitions)]
67

78
struct Foo;
89

src/tools/clippy/tests/ui/from_over_into.fixed

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![feature(type_alias_impl_trait)]
22
#![warn(clippy::from_over_into)]
3+
#![allow(non_local_definitions)]
34
#![allow(unused)]
45

56
// this should throw an error

src/tools/clippy/tests/ui/from_over_into.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![feature(type_alias_impl_trait)]
22
#![warn(clippy::from_over_into)]
3+
#![allow(non_local_definitions)]
34
#![allow(unused)]
45

56
// this should throw an error

src/tools/clippy/tests/ui/from_over_into.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
2-
--> $DIR/from_over_into.rs:8:1
2+
--> $DIR/from_over_into.rs:9:1
33
|
44
LL | impl Into<StringWrapper> for String {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -14,7 +14,7 @@ LL ~ StringWrapper(val)
1414
|
1515

1616
error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
17-
--> $DIR/from_over_into.rs:16:1
17+
--> $DIR/from_over_into.rs:17:1
1818
|
1919
LL | impl Into<SelfType> for String {
2020
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -27,7 +27,7 @@ LL ~ SelfType(String::new())
2727
|
2828

2929
error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
30-
--> $DIR/from_over_into.rs:31:1
30+
--> $DIR/from_over_into.rs:32:1
3131
|
3232
LL | impl Into<SelfKeywords> for X {
3333
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -42,7 +42,7 @@ LL ~ let _: X = val;
4242
|
4343

4444
error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
45-
--> $DIR/from_over_into.rs:43:1
45+
--> $DIR/from_over_into.rs:44:1
4646
|
4747
LL | impl core::convert::Into<bool> for crate::ExplicitPaths {
4848
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -60,7 +60,7 @@ LL ~ val.0
6060
|
6161

6262
error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
63-
--> $DIR/from_over_into.rs:63:1
63+
--> $DIR/from_over_into.rs:64:1
6464
|
6565
LL | impl Into<String> for PathInExpansion {
6666
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -74,7 +74,7 @@ LL ~ fn from(val: PathInExpansion) -> Self {
7474
|
7575

7676
error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
77-
--> $DIR/from_over_into.rs:85:5
77+
--> $DIR/from_over_into.rs:86:5
7878
|
7979
LL | impl<T> Into<FromOverInto<T>> for Vec<T> {
8080
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -87,7 +87,7 @@ LL ~ FromOverInto(val)
8787
|
8888

8989
error: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
90-
--> $DIR/from_over_into.rs:95:5
90+
--> $DIR/from_over_into.rs:96:5
9191
|
9292
LL | impl Into<()> for Hello {
9393
| ^^^^^^^^^^^^^^^^^^^^^^^

src/tools/clippy/tests/ui/manual_str_repeat.fixed

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(non_local_definitions)]
12
#![warn(clippy::manual_str_repeat)]
23

34
use std::borrow::Cow;

src/tools/clippy/tests/ui/manual_str_repeat.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(non_local_definitions)]
12
#![warn(clippy::manual_str_repeat)]
23

34
use std::borrow::Cow;

src/tools/clippy/tests/ui/manual_str_repeat.stderr

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: manual implementation of `str::repeat` using iterators
2-
--> $DIR/manual_str_repeat.rs:7:21
2+
--> $DIR/manual_str_repeat.rs:8:21
33
|
44
LL | let _: String = std::iter::repeat("test").take(10).collect();
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"test".repeat(10)`
@@ -8,55 +8,55 @@ LL | let _: String = std::iter::repeat("test").take(10).collect();
88
= help: to override `-D warnings` add `#[allow(clippy::manual_str_repeat)]`
99

1010
error: manual implementation of `str::repeat` using iterators
11-
--> $DIR/manual_str_repeat.rs:8:21
11+
--> $DIR/manual_str_repeat.rs:9:21
1212
|
1313
LL | let _: String = std::iter::repeat('x').take(10).collect();
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"x".repeat(10)`
1515

1616
error: manual implementation of `str::repeat` using iterators
17-
--> $DIR/manual_str_repeat.rs:9:21
17+
--> $DIR/manual_str_repeat.rs:10:21
1818
|
1919
LL | let _: String = std::iter::repeat('\'').take(10).collect();
2020
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"'".repeat(10)`
2121

2222
error: manual implementation of `str::repeat` using iterators
23-
--> $DIR/manual_str_repeat.rs:10:21
23+
--> $DIR/manual_str_repeat.rs:11:21
2424
|
2525
LL | let _: String = std::iter::repeat('"').take(10).collect();
2626
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"\"".repeat(10)`
2727

2828
error: manual implementation of `str::repeat` using iterators
29-
--> $DIR/manual_str_repeat.rs:14:13
29+
--> $DIR/manual_str_repeat.rs:15:13
3030
|
3131
LL | let _ = repeat(x).take(count + 2).collect::<String>();
3232
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.repeat(count + 2)`
3333

3434
error: manual implementation of `str::repeat` using iterators
35-
--> $DIR/manual_str_repeat.rs:23:21
35+
--> $DIR/manual_str_repeat.rs:24:21
3636
|
3737
LL | let _: String = repeat(*x).take(count).collect();
3838
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(*x).repeat(count)`
3939

4040
error: manual implementation of `str::repeat` using iterators
41-
--> $DIR/manual_str_repeat.rs:32:21
41+
--> $DIR/manual_str_repeat.rs:33:21
4242
|
4343
LL | let _: String = repeat(x).take(count).collect();
4444
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.repeat(count)`
4545

4646
error: manual implementation of `str::repeat` using iterators
47-
--> $DIR/manual_str_repeat.rs:44:21
47+
--> $DIR/manual_str_repeat.rs:45:21
4848
|
4949
LL | let _: String = repeat(Cow::Borrowed("test")).take(count).collect();
5050
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Cow::Borrowed("test").repeat(count)`
5151

5252
error: manual implementation of `str::repeat` using iterators
53-
--> $DIR/manual_str_repeat.rs:47:21
53+
--> $DIR/manual_str_repeat.rs:48:21
5454
|
5555
LL | let _: String = repeat(x).take(count).collect();
5656
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.repeat(count)`
5757

5858
error: manual implementation of `str::repeat` using iterators
59-
--> $DIR/manual_str_repeat.rs:62:21
59+
--> $DIR/manual_str_repeat.rs:63:21
6060
|
6161
LL | let _: String = std::iter::repeat("test").take(10).collect();
6262
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `"test".repeat(10)`

0 commit comments

Comments
 (0)