Skip to content

Commit 593454a

Browse files
committed
wiggle test code, fix invalid test code
1 parent f027f2c commit 593454a

11 files changed

+93
-90
lines changed

tests/ui-internal/unnecessary_def_path.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@aux-build:paths.rs
22
#![deny(clippy::internal)]
33
#![feature(rustc_private)]
4+
#![allow(clippy::unnecessary_map_or)]
45

56
extern crate clippy_utils;
67
extern crate paths;

tests/ui-internal/unnecessary_def_path.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@aux-build:paths.rs
22
#![deny(clippy::internal)]
33
#![feature(rustc_private)]
4+
#![allow(clippy::unnecessary_map_or)]
45

56
extern crate clippy_utils;
67
extern crate paths;

tests/ui-internal/unnecessary_def_path.stderr

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: use of a def path to a diagnostic item
2-
--> $DIR/unnecessary_def_path.rs:36:13
2+
--> $DIR/unnecessary_def_path.rs:37:13
33
|
44
LL | let _ = match_type(cx, ty, &OPTION);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Option)`
@@ -12,87 +12,87 @@ LL | #![deny(clippy::internal)]
1212
= note: `#[deny(clippy::unnecessary_def_path)]` implied by `#[deny(clippy::internal)]`
1313

1414
error: use of a def path to a diagnostic item
15-
--> $DIR/unnecessary_def_path.rs:37:13
15+
--> $DIR/unnecessary_def_path.rs:38:13
1616
|
1717
LL | let _ = match_type(cx, ty, RESULT);
1818
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Result)`
1919

2020
error: use of a def path to a diagnostic item
21-
--> $DIR/unnecessary_def_path.rs:38:13
21+
--> $DIR/unnecessary_def_path.rs:39:13
2222
|
2323
LL | let _ = match_type(cx, ty, &["core", "result", "Result"]);
2424
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Result)`
2525

2626
error: use of a def path to a diagnostic item
27-
--> $DIR/unnecessary_def_path.rs:42:13
27+
--> $DIR/unnecessary_def_path.rs:43:13
2828
|
2929
LL | let _ = clippy_utils::ty::match_type(cx, ty, rc_path);
3030
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Rc)`
3131

3232
error: use of a def path to a diagnostic item
33-
--> $DIR/unnecessary_def_path.rs:44:13
33+
--> $DIR/unnecessary_def_path.rs:45:13
3434
|
3535
LL | let _ = match_type(cx, ty, &paths::OPTION);
3636
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Option)`
3737

3838
error: use of a def path to a diagnostic item
39-
--> $DIR/unnecessary_def_path.rs:45:13
39+
--> $DIR/unnecessary_def_path.rs:46:13
4040
|
4141
LL | let _ = match_type(cx, ty, paths::RESULT);
4242
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::Result)`
4343

4444
error: use of a def path to a `LangItem`
45-
--> $DIR/unnecessary_def_path.rs:47:13
45+
--> $DIR/unnecessary_def_path.rs:48:13
4646
|
4747
LL | let _ = match_type(cx, ty, &["alloc", "boxed", "Box"]);
4848
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_lang_item(cx, ty, LangItem::OwnedBox)`
4949

5050
error: use of a def path to a diagnostic item
51-
--> $DIR/unnecessary_def_path.rs:48:13
51+
--> $DIR/unnecessary_def_path.rs:49:13
5252
|
5353
LL | let _ = match_type(cx, ty, &["core", "mem", "maybe_uninit", "MaybeUninit", "uninit"]);
5454
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_type_diagnostic_item(cx, ty, sym::maybe_uninit_uninit)`
5555

5656
error: use of a def path to a `LangItem`
57-
--> $DIR/unnecessary_def_path.rs:50:13
57+
--> $DIR/unnecessary_def_path.rs:51:13
5858
|
5959
LL | let _ = match_def_path(cx, did, &["alloc", "boxed", "Box"]);
6060
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cx.tcx.lang_items().get(LangItem::OwnedBox) == Some(did)`
6161

6262
error: use of a def path to a diagnostic item
63-
--> $DIR/unnecessary_def_path.rs:51:13
63+
--> $DIR/unnecessary_def_path.rs:52:13
6464
|
6565
LL | let _ = match_def_path(cx, did, &["core", "option", "Option"]);
6666
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cx.tcx.is_diagnostic_item(sym::Option, did)`
6767

6868
error: use of a def path to a `LangItem`
69-
--> $DIR/unnecessary_def_path.rs:52:13
69+
--> $DIR/unnecessary_def_path.rs:53:13
7070
|
7171
LL | let _ = match_def_path(cx, did, &["core", "option", "Option", "Some"]);
7272
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `cx.tcx.lang_items().get(LangItem::OptionSome) == Some(did)`
7373
|
7474
= help: if this `DefId` came from a constructor expression or pattern then the parent `DefId` should be used instead
7575

7676
error: use of a def path to a diagnostic item
77-
--> $DIR/unnecessary_def_path.rs:54:13
77+
--> $DIR/unnecessary_def_path.rs:55:13
7878
|
7979
LL | let _ = match_trait_method(cx, expr, &["core", "convert", "AsRef"]);
8080
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_trait_method(cx, expr, sym::AsRef)`
8181

8282
error: use of a def path to a diagnostic item
83-
--> $DIR/unnecessary_def_path.rs:56:13
83+
--> $DIR/unnecessary_def_path.rs:57:13
8484
|
8585
LL | let _ = is_expr_path_def_path(cx, expr, &["core", "option", "Option"]);
8686
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_path_diagnostic_item(cx, expr, sym::Option)`
8787

8888
error: use of a def path to a `LangItem`
89-
--> $DIR/unnecessary_def_path.rs:57:13
89+
--> $DIR/unnecessary_def_path.rs:58:13
9090
|
9191
LL | let _ = is_expr_path_def_path(cx, expr, &["core", "iter", "traits", "Iterator", "next"]);
9292
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `path_res(cx, expr).opt_def_id().map_or(false, |id| cx.tcx.lang_items().get(LangItem::IteratorNext) == Some(id))`
9393

9494
error: use of a def path to a `LangItem`
95-
--> $DIR/unnecessary_def_path.rs:58:13
95+
--> $DIR/unnecessary_def_path.rs:59:13
9696
|
9797
LL | let _ = is_expr_path_def_path(cx, expr, &["core", "option", "Option", "Some"]);
9898
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `is_res_lang_ctor(cx, path_res(cx, expr), LangItem::OptionSome)`

tests/ui/case_sensitive_file_extension_comparisons.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::case_sensitive_file_extension_comparisons)]
2+
#![allow(clippy::unnecessary_map_or)]
23

34
use std::string::String;
45

tests/ui/case_sensitive_file_extension_comparisons.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::case_sensitive_file_extension_comparisons)]
2+
#![allow(clippy::unnecessary_map_or)]
23

34
use std::string::String;
45

tests/ui/case_sensitive_file_extension_comparisons.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: case-sensitive file extension comparison
2-
--> $DIR/case_sensitive_file_extension_comparisons.rs:13:5
2+
--> $DIR/case_sensitive_file_extension_comparisons.rs:14:5
33
|
44
LL | filename.ends_with(".rs")
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -15,7 +15,7 @@ LL + .map_or(false, |ext| ext.eq_ignore_ascii_case("rs"))
1515
|
1616

1717
error: case-sensitive file extension comparison
18-
--> $DIR/case_sensitive_file_extension_comparisons.rs:18:13
18+
--> $DIR/case_sensitive_file_extension_comparisons.rs:19:13
1919
|
2020
LL | let _ = String::new().ends_with(".ext12");
2121
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -29,7 +29,7 @@ LL ~ .map_or(false, |ext| ext.eq_ignore_ascii_case("ext12"));
2929
|
3030

3131
error: case-sensitive file extension comparison
32-
--> $DIR/case_sensitive_file_extension_comparisons.rs:19:13
32+
--> $DIR/case_sensitive_file_extension_comparisons.rs:20:13
3333
|
3434
LL | let _ = "str".ends_with(".ext12");
3535
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -43,7 +43,7 @@ LL ~ .map_or(false, |ext| ext.eq_ignore_ascii_case("ext12"));
4343
|
4444

4545
error: case-sensitive file extension comparison
46-
--> $DIR/case_sensitive_file_extension_comparisons.rs:23:17
46+
--> $DIR/case_sensitive_file_extension_comparisons.rs:24:17
4747
|
4848
LL | let _ = "str".ends_with(".ext12");
4949
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -57,7 +57,7 @@ LL ~ .map_or(false, |ext| ext.eq_ignore_ascii_case("ext12"));
5757
|
5858

5959
error: case-sensitive file extension comparison
60-
--> $DIR/case_sensitive_file_extension_comparisons.rs:30:13
60+
--> $DIR/case_sensitive_file_extension_comparisons.rs:31:13
6161
|
6262
LL | let _ = String::new().ends_with(".EXT12");
6363
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -71,7 +71,7 @@ LL ~ .map_or(false, |ext| ext.eq_ignore_ascii_case("EXT12"));
7171
|
7272

7373
error: case-sensitive file extension comparison
74-
--> $DIR/case_sensitive_file_extension_comparisons.rs:31:13
74+
--> $DIR/case_sensitive_file_extension_comparisons.rs:32:13
7575
|
7676
LL | let _ = "str".ends_with(".EXT12");
7777
| ^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/rename.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#![allow(clippy::single_char_add_str)]
2828
#![allow(clippy::module_name_repetitions)]
2929
#![allow(clippy::recursive_format_impl)]
30+
#![allow(clippy::unnecessary_map_or)]
3031
#![allow(clippy::unwrap_or_default)]
3132
#![allow(clippy::invisible_characters)]
3233
#![allow(invalid_reference_casting)]

0 commit comments

Comments
 (0)