Skip to content

Commit 543a8a6

Browse files
committed
Auto merge of rust-lang#7285 - camsteffen:mini-macro-move, r=flip1995
Move mini-macro to tests/ui/auxilary changelog: none Merges `/mini-macro` into `/tests/ui/auxilary/proc_macro_derive.rs`. The mini-macro crate is an artifact of the distant past. A lot has changed (rust-lang#2284) and it doesn't make sense as a top-level crate anymore. Especially since we can use the auxilary folder to accompolish the same thing.
2 parents 16e347f + 6c54f61 commit 543a8a6

11 files changed

+43
-75
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ tempfile = { version = "3.1.0", optional = true }
3333
cargo_metadata = "0.12"
3434
compiletest_rs = { version = "0.6.0", features = ["tmp"] }
3535
tester = "0.9"
36-
clippy-mini-macro-test = { version = "0.2", path = "mini-macro" }
3736
serde = { version = "1.0", features = ["derive"] }
3837
derive-new = "0.5"
3938
regex = "1.4"

mini-macro/Cargo.toml

Lines changed: 0 additions & 14 deletions
This file was deleted.

mini-macro/src/lib.rs

Lines changed: 0 additions & 29 deletions
This file was deleted.

tests/ui/auxiliary/proc_macro_derive.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,22 @@ pub fn derive_use_self(_input: TokenStream) -> proc_macro::TokenStream {
5353
}
5454
}
5555
}
56+
57+
#[proc_macro_derive(ClippyMiniMacroTest)]
58+
pub fn mini_macro(_: TokenStream) -> TokenStream {
59+
quote!(
60+
#[allow(unused)]
61+
fn needless_take_by_value(s: String) {
62+
println!("{}", s.len());
63+
}
64+
#[allow(unused)]
65+
fn needless_loop(items: &[u8]) {
66+
for i in 0..items.len() {
67+
println!("{}", items[i]);
68+
}
69+
}
70+
fn line_wrapper() {
71+
println!("{}", line!());
72+
}
73+
)
74+
}

tests/ui/crashes/procedural_macro.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/ui/macro_use_imports.fixed

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// compile-flags: --edition 2018
22
// aux-build:macro_rules.rs
33
// aux-build:macro_use_helper.rs
4+
// aux-build:proc_macro_derive.rs
45
// run-rustfix
56
// ignore-32bit
67

@@ -12,7 +13,7 @@
1213
extern crate macro_use_helper as mac;
1314

1415
#[macro_use]
15-
extern crate clippy_mini_macro_test as mini_mac;
16+
extern crate proc_macro_derive as mini_mac;
1617

1718
mod a {
1819
use mac::{pub_macro, inner_mod_macro, function_macro, ty_macro, pub_in_private_macro};

tests/ui/macro_use_imports.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// compile-flags: --edition 2018
22
// aux-build:macro_rules.rs
33
// aux-build:macro_use_helper.rs
4+
// aux-build:proc_macro_derive.rs
45
// run-rustfix
56
// ignore-32bit
67

@@ -12,7 +13,7 @@
1213
extern crate macro_use_helper as mac;
1314

1415
#[macro_use]
15-
extern crate clippy_mini_macro_test as mini_mac;
16+
extern crate proc_macro_derive as mini_mac;
1617

1718
mod a {
1819
#[macro_use]

tests/ui/macro_use_imports.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
error: `macro_use` attributes are no longer needed in the Rust 2018 edition
2-
--> $DIR/macro_use_imports.rs:18:5
2+
--> $DIR/macro_use_imports.rs:19:5
33
|
44
LL | #[macro_use]
55
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::{pub_macro, inner_mod_macro, function_macro, ty_macro, pub_in_private_macro};`
66
|
77
= note: `-D clippy::macro-use-imports` implied by `-D warnings`
88

99
error: `macro_use` attributes are no longer needed in the Rust 2018 edition
10-
--> $DIR/macro_use_imports.rs:20:5
10+
--> $DIR/macro_use_imports.rs:25:5
1111
|
1212
LL | #[macro_use]
13-
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mini_mac::ClippyMiniMacroTest;`
13+
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::inner::nested::string_add;`
1414

1515
error: `macro_use` attributes are no longer needed in the Rust 2018 edition
16-
--> $DIR/macro_use_imports.rs:22:5
16+
--> $DIR/macro_use_imports.rs:21:5
1717
|
1818
LL | #[macro_use]
19-
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::{inner::foofoo, inner::try_err};`
19+
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mini_mac::ClippyMiniMacroTest;`
2020

2121
error: `macro_use` attributes are no longer needed in the Rust 2018 edition
22-
--> $DIR/macro_use_imports.rs:24:5
22+
--> $DIR/macro_use_imports.rs:23:5
2323
|
2424
LL | #[macro_use]
25-
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::inner::nested::string_add;`
25+
| ^^^^^^^^^^^^ help: remove the attribute and import the macro directly, try: `use mac::{inner::foofoo, inner::try_err};`
2626

2727
error: aborting due to 4 previous errors
2828

tests/ui/unseparated_prefix_literals.fixed

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
// run-rustfix
2+
// aux-build:proc_macro_derive.rs
23

34
#![warn(clippy::unseparated_literal_suffix)]
45
#![allow(dead_code)]
56

67
#[macro_use]
7-
extern crate clippy_mini_macro_test;
8+
extern crate proc_macro_derive;
89

910
// Test for proc-macro attribute
1011
#[derive(ClippyMiniMacroTest)]

tests/ui/unseparated_prefix_literals.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
// run-rustfix
2+
// aux-build:proc_macro_derive.rs
23

34
#![warn(clippy::unseparated_literal_suffix)]
45
#![allow(dead_code)]
56

67
#[macro_use]
7-
extern crate clippy_mini_macro_test;
8+
extern crate proc_macro_derive;
89

910
// Test for proc-macro attribute
1011
#[derive(ClippyMiniMacroTest)]

tests/ui/unseparated_prefix_literals.stderr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
error: integer type suffix should be separated by an underscore
2-
--> $DIR/unseparated_prefix_literals.rs:23:18
2+
--> $DIR/unseparated_prefix_literals.rs:24:18
33
|
44
LL | let _fail1 = 1234i32;
55
| ^^^^^^^ help: add an underscore: `1234_i32`
66
|
77
= note: `-D clippy::unseparated-literal-suffix` implied by `-D warnings`
88

99
error: integer type suffix should be separated by an underscore
10-
--> $DIR/unseparated_prefix_literals.rs:24:18
10+
--> $DIR/unseparated_prefix_literals.rs:25:18
1111
|
1212
LL | let _fail2 = 1234u32;
1313
| ^^^^^^^ help: add an underscore: `1234_u32`
1414

1515
error: integer type suffix should be separated by an underscore
16-
--> $DIR/unseparated_prefix_literals.rs:25:18
16+
--> $DIR/unseparated_prefix_literals.rs:26:18
1717
|
1818
LL | let _fail3 = 1234isize;
1919
| ^^^^^^^^^ help: add an underscore: `1234_isize`
2020

2121
error: integer type suffix should be separated by an underscore
22-
--> $DIR/unseparated_prefix_literals.rs:26:18
22+
--> $DIR/unseparated_prefix_literals.rs:27:18
2323
|
2424
LL | let _fail4 = 1234usize;
2525
| ^^^^^^^^^ help: add an underscore: `1234_usize`
2626

2727
error: integer type suffix should be separated by an underscore
28-
--> $DIR/unseparated_prefix_literals.rs:27:18
28+
--> $DIR/unseparated_prefix_literals.rs:28:18
2929
|
3030
LL | let _fail5 = 0x123isize;
3131
| ^^^^^^^^^^ help: add an underscore: `0x123_isize`
3232

3333
error: float type suffix should be separated by an underscore
34-
--> $DIR/unseparated_prefix_literals.rs:31:19
34+
--> $DIR/unseparated_prefix_literals.rs:32:19
3535
|
3636
LL | let _failf1 = 1.5f32;
3737
| ^^^^^^ help: add an underscore: `1.5_f32`
3838

3939
error: float type suffix should be separated by an underscore
40-
--> $DIR/unseparated_prefix_literals.rs:32:19
40+
--> $DIR/unseparated_prefix_literals.rs:33:19
4141
|
4242
LL | let _failf2 = 1f32;
4343
| ^^^^ help: add an underscore: `1_f32`
4444

4545
error: integer type suffix should be separated by an underscore
46-
--> $DIR/unseparated_prefix_literals.rs:15:9
46+
--> $DIR/unseparated_prefix_literals.rs:16:9
4747
|
4848
LL | 42usize
4949
| ^^^^^^^ help: add an underscore: `42_usize`
@@ -54,7 +54,7 @@ LL | let _ = lit_from_macro!();
5454
= note: this error originates in the macro `lit_from_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
5555

5656
error: integer type suffix should be separated by an underscore
57-
--> $DIR/unseparated_prefix_literals.rs:40:16
57+
--> $DIR/unseparated_prefix_literals.rs:41:16
5858
|
5959
LL | assert_eq!(4897u32, 32223);
6060
| ^^^^^^^ help: add an underscore: `4897_u32`

0 commit comments

Comments
 (0)