Coalesce non_snake_case
crate test set with revisions
This commit is contained in:
parent
43ede7331d
commit
9ae1fb4329
18 changed files with 65 additions and 100 deletions
|
@ -1,7 +0,0 @@
|
|||
//@ only-x86_64-unknown-linux-gnu
|
||||
//@ check-pass
|
||||
#![crate_name = "NonSnakeCase"]
|
||||
|
||||
#![deny(non_snake_case)]
|
||||
|
||||
fn main() {}
|
|
@ -1,7 +0,0 @@
|
|||
//@ only-x86_64-unknown-linux-gnu
|
||||
//@ compile-flags: --crate-name NonSnakeCase
|
||||
//@ check-pass
|
||||
|
||||
#![deny(non_snake_case)]
|
||||
|
||||
fn main() {}
|
|
@ -1,8 +0,0 @@
|
|||
//@ only-x86_64-unknown-linux-gnu
|
||||
//@ check-pass
|
||||
#![crate_type = "bin"]
|
||||
#![crate_name = "NonSnakeCase"]
|
||||
|
||||
#![deny(non_snake_case)]
|
||||
|
||||
fn main() {}
|
|
@ -1,7 +0,0 @@
|
|||
//@ only-x86_64-unknown-linux-gnu
|
||||
#![crate_type = "cdylib"]
|
||||
#![crate_name = "NonSnakeCase"]
|
||||
//~^ ERROR crate `NonSnakeCase` should have a snake case name
|
||||
#![deny(non_snake_case)]
|
||||
|
||||
fn main() {}
|
|
@ -1,7 +0,0 @@
|
|||
//@ only-x86_64-unknown-linux-gnu
|
||||
#![crate_type = "dylib"]
|
||||
#![crate_name = "NonSnakeCase"]
|
||||
//~^ ERROR crate `NonSnakeCase` should have a snake case name
|
||||
#![deny(non_snake_case)]
|
||||
|
||||
fn main() {}
|
|
@ -1,7 +0,0 @@
|
|||
//@ only-x86_64-unknown-linux-gnu
|
||||
#![crate_type = "lib"]
|
||||
#![crate_name = "NonSnakeCase"]
|
||||
//~^ ERROR crate `NonSnakeCase` should have a snake case name
|
||||
#![deny(non_snake_case)]
|
||||
|
||||
fn main() {}
|
|
@ -1,7 +0,0 @@
|
|||
//@ only-x86_64-unknown-linux-gnu
|
||||
#![crate_type = "proc-macro"]
|
||||
#![crate_name = "NonSnakeCase"]
|
||||
//~^ ERROR crate `NonSnakeCase` should have a snake case name
|
||||
#![deny(non_snake_case)]
|
||||
|
||||
fn main() {}
|
|
@ -1,14 +0,0 @@
|
|||
error: crate `NonSnakeCase` should have a snake case name
|
||||
--> $DIR/lint-non-snake-case-crate-proc-macro.rs:3:18
|
||||
|
|
||||
LL | #![crate_name = "NonSnakeCase"]
|
||||
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-non-snake-case-crate-proc-macro.rs:5:9
|
||||
|
|
||||
LL | #![deny(non_snake_case)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
//@ only-x86_64-unknown-linux-gnu
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_name = "NonSnakeCase"]
|
||||
//~^ ERROR crate `NonSnakeCase` should have a snake case name
|
||||
#![deny(non_snake_case)]
|
||||
|
||||
fn main() {}
|
|
@ -1,7 +0,0 @@
|
|||
//@ only-x86_64-unknown-linux-gnu
|
||||
#![crate_type = "staticlib"]
|
||||
#![crate_name = "NonSnakeCase"]
|
||||
//~^ ERROR crate `NonSnakeCase` should have a snake case name
|
||||
#![deny(non_snake_case)]
|
||||
|
||||
fn main() {}
|
|
@ -1,14 +0,0 @@
|
|||
error: crate `NonSnakeCase` should have a snake case name
|
||||
--> $DIR/lint-non-snake-case-crate-staticlib.rs:3:18
|
||||
|
|
||||
LL | #![crate_name = "NonSnakeCase"]
|
||||
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-non-snake-case-crate-staticlib.rs:5:9
|
||||
|
|
||||
LL | #![deny(non_snake_case)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
error: crate `NonSnakeCase` should have a snake case name
|
||||
--> $DIR/lint-non-snake-case-crate-lib.rs:3:18
|
||||
--> $DIR/lint-non-snake-case-crate.rs:25:18
|
||||
|
|
||||
LL | #![crate_name = "NonSnakeCase"]
|
||||
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-non-snake-case-crate-lib.rs:5:9
|
||||
--> $DIR/lint-non-snake-case-crate.rs:27:9
|
||||
|
|
||||
LL | #![deny(non_snake_case)]
|
||||
| ^^^^^^^^^^^^^^
|
|
@ -1,11 +1,11 @@
|
|||
error: crate `NonSnakeCase` should have a snake case name
|
||||
--> $DIR/lint-non-snake-case-crate-rlib.rs:3:18
|
||||
--> $DIR/lint-non-snake-case-crate.rs:25:18
|
||||
|
|
||||
LL | #![crate_name = "NonSnakeCase"]
|
||||
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-non-snake-case-crate-rlib.rs:5:9
|
||||
--> $DIR/lint-non-snake-case-crate.rs:27:9
|
||||
|
|
||||
LL | #![deny(non_snake_case)]
|
||||
| ^^^^^^^^^^^^^^
|
|
@ -1,11 +1,11 @@
|
|||
error: crate `NonSnakeCase` should have a snake case name
|
||||
--> $DIR/lint-non-snake-case-crate-dylib.rs:3:18
|
||||
--> $DIR/lint-non-snake-case-crate.rs:25:18
|
||||
|
|
||||
LL | #![crate_name = "NonSnakeCase"]
|
||||
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-non-snake-case-crate-dylib.rs:5:9
|
||||
--> $DIR/lint-non-snake-case-crate.rs:27:9
|
||||
|
|
||||
LL | #![deny(non_snake_case)]
|
||||
| ^^^^^^^^^^^^^^
|
|
@ -1,11 +1,11 @@
|
|||
error: crate `NonSnakeCase` should have a snake case name
|
||||
--> $DIR/lint-non-snake-case-crate-cdylib.rs:3:18
|
||||
--> $DIR/lint-non-snake-case-crate.rs:25:18
|
||||
|
|
||||
LL | #![crate_name = "NonSnakeCase"]
|
||||
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-non-snake-case-crate-cdylib.rs:5:9
|
||||
--> $DIR/lint-non-snake-case-crate.rs:27:9
|
||||
|
|
||||
LL | #![deny(non_snake_case)]
|
||||
| ^^^^^^^^^^^^^^
|
|
@ -0,0 +1,14 @@
|
|||
error: crate `NonSnakeCase` should have a snake case name
|
||||
--> $DIR/lint-non-snake-case-crate.rs:25:18
|
||||
|
|
||||
LL | #![crate_name = "NonSnakeCase"]
|
||||
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-non-snake-case-crate.rs:27:9
|
||||
|
|
||||
LL | #![deny(non_snake_case)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
29
tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rs
Normal file
29
tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rs
Normal file
|
@ -0,0 +1,29 @@
|
|||
//! Don't lint on binary crate with non-snake-case names.
|
||||
//!
|
||||
//! See <https://github.com/rust-lang/rust/issues/45127>.
|
||||
|
||||
//@ revisions: bin_ cdylib_ dylib_ lib_ proc_macro_ rlib_ staticlib_
|
||||
|
||||
// Should not fire on binary crates.
|
||||
//@[bin_] compile-flags: --crate-type=bin
|
||||
//@[bin_] check-pass
|
||||
|
||||
// But should fire on non-binary crates.
|
||||
|
||||
//@[cdylib_] ignore-musl (dylibs are not supported)
|
||||
//@[dylib_] ignore-musl (dylibs are not supported)
|
||||
//@[dylib_] ignore-wasm (dylib is not supported)
|
||||
//@[proc_macro_] ignore-wasm (dylib is not supported)
|
||||
|
||||
//@[cdylib_] compile-flags: --crate-type=cdylib
|
||||
//@[dylib_] compile-flags: --crate-type=dylib
|
||||
//@[lib_] compile-flags: --crate-type=lib
|
||||
//@[proc_macro_] compile-flags: --crate-type=proc-macro
|
||||
//@[rlib_] compile-flags: --crate-type=rlib
|
||||
//@[staticlib_] compile-flags: --crate-type=staticlib
|
||||
|
||||
#![crate_name = "NonSnakeCase"]
|
||||
//[cdylib_,dylib_,lib_,proc_macro_,rlib_,staticlib_]~^ ERROR crate `NonSnakeCase` should have a snake case name
|
||||
#![deny(non_snake_case)]
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,14 @@
|
|||
error: crate `NonSnakeCase` should have a snake case name
|
||||
--> $DIR/lint-non-snake-case-crate.rs:25:18
|
||||
|
|
||||
LL | #![crate_name = "NonSnakeCase"]
|
||||
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-non-snake-case-crate.rs:27:9
|
||||
|
|
||||
LL | #![deny(non_snake_case)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue