Skip to content

Move mini-macro to tests/ui/auxilary #7285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ tempfile = { version = "3.1.0", optional = true }
cargo_metadata = "0.12"
compiletest_rs = { version = "0.6.0", features = ["tmp"] }
tester = "0.9"
clippy-mini-macro-test = { version = "0.2", path = "mini-macro" }
serde = { version = "1.0", features = ["derive"] }
derive-new = "0.5"
regex = "1.4"
Expand Down
14 changes: 0 additions & 14 deletions mini-macro/Cargo.toml

This file was deleted.

29 changes: 0 additions & 29 deletions mini-macro/src/lib.rs

This file was deleted.

19 changes: 19 additions & 0 deletions tests/ui/auxiliary/proc_macro_derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,22 @@ pub fn derive_use_self(_input: TokenStream) -> proc_macro::TokenStream {
}
}
}

#[proc_macro_derive(ClippyMiniMacroTest)]
pub fn mini_macro(_: TokenStream) -> TokenStream {
quote!(
#[allow(unused)]
fn needless_take_by_value(s: String) {
println!("{}", s.len());
}
#[allow(unused)]
fn needless_loop(items: &[u8]) {
for i in 0..items.len() {
println!("{}", items[i]);
}
}
fn line_wrapper() {
println!("{}", line!());
}
)
}
11 changes: 0 additions & 11 deletions tests/ui/crashes/procedural_macro.rs

This file was deleted.

3 changes: 2 additions & 1 deletion tests/ui/macro_use_imports.fixed
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// compile-flags: --edition 2018
// aux-build:macro_rules.rs
// aux-build:macro_use_helper.rs
// aux-build:proc_macro_derive.rs
// run-rustfix
// ignore-32bit

Expand All @@ -12,7 +13,7 @@
extern crate macro_use_helper as mac;

#[macro_use]
extern crate clippy_mini_macro_test as mini_mac;
extern crate proc_macro_derive as mini_mac;

mod a {
use mac::{pub_macro, inner_mod_macro, function_macro, ty_macro, pub_in_private_macro};
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/macro_use_imports.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// compile-flags: --edition 2018
// aux-build:macro_rules.rs
// aux-build:macro_use_helper.rs
// aux-build:proc_macro_derive.rs
// run-rustfix
// ignore-32bit

Expand All @@ -12,7 +13,7 @@
extern crate macro_use_helper as mac;

#[macro_use]
extern crate clippy_mini_macro_test as mini_mac;
extern crate proc_macro_derive as mini_mac;

mod a {
#[macro_use]
Expand Down
14 changes: 7 additions & 7 deletions tests/ui/macro_use_imports.stderr
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
error: `macro_use` attributes are no longer needed in the Rust 2018 edition
--> $DIR/macro_use_imports.rs:18:5
--> $DIR/macro_use_imports.rs:19:5
|
LL | #[macro_use]
| ^^^^^^^^^^^^ 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};`
|
= note: `-D clippy::macro-use-imports` implied by `-D warnings`

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

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

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

error: aborting due to 4 previous errors

3 changes: 2 additions & 1 deletion tests/ui/unseparated_prefix_literals.fixed
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// run-rustfix
// aux-build:proc_macro_derive.rs

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

#[macro_use]
extern crate clippy_mini_macro_test;
extern crate proc_macro_derive;

// Test for proc-macro attribute
#[derive(ClippyMiniMacroTest)]
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/unseparated_prefix_literals.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// run-rustfix
// aux-build:proc_macro_derive.rs

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

#[macro_use]
extern crate clippy_mini_macro_test;
extern crate proc_macro_derive;

// Test for proc-macro attribute
#[derive(ClippyMiniMacroTest)]
Expand Down
18 changes: 9 additions & 9 deletions tests/ui/unseparated_prefix_literals.stderr
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
error: integer type suffix should be separated by an underscore
--> $DIR/unseparated_prefix_literals.rs:23:18
--> $DIR/unseparated_prefix_literals.rs:24:18
|
LL | let _fail1 = 1234i32;
| ^^^^^^^ help: add an underscore: `1234_i32`
|
= note: `-D clippy::unseparated-literal-suffix` implied by `-D warnings`

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

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

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

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

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

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

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

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