mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-15 05:26:47 +00:00
add uitests for cargo rust-version field
This commit is contained in:
parent
6384765665
commit
f0a1cd5645
@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "fail-both-diff"
|
||||
version = "0.1.0"
|
||||
rust-version = "1.56"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
@ -0,0 +1 @@
|
||||
msrv = "1.59"
|
11
tests/ui-cargo/cargo_rust_version/fail_both_diff/src/main.rs
Normal file
11
tests/ui-cargo/cargo_rust_version/fail_both_diff/src/main.rs
Normal file
@ -0,0 +1,11 @@
|
||||
#![deny(clippy::use_self)]
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
impl Foo {
|
||||
pub fn bar() -> Foo {
|
||||
Foo
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,16 @@
|
||||
warning: the MSRV in `clippy.toml` and `Cargo.toml` differ; using `1.59.0` from `clippy.toml`
|
||||
|
||||
error: unnecessary structure name repetition
|
||||
--> $DIR/main.rs:6:21
|
||||
|
|
||||
LL | pub fn bar() -> Foo {
|
||||
| ^^^ help: use the applicable keyword: `Self`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/main.rs:1:9
|
||||
|
|
||||
LL | #![deny(clippy::use_self)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "fail-both-same"
|
||||
version = "0.1.0"
|
||||
rust-version = "1.57.0"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
@ -0,0 +1 @@
|
||||
msrv = "1.57"
|
11
tests/ui-cargo/cargo_rust_version/fail_both_same/src/main.rs
Normal file
11
tests/ui-cargo/cargo_rust_version/fail_both_same/src/main.rs
Normal file
@ -0,0 +1,11 @@
|
||||
#![deny(clippy::use_self)]
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
impl Foo {
|
||||
pub fn bar() -> Foo {
|
||||
Foo
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,14 @@
|
||||
error: unnecessary structure name repetition
|
||||
--> $DIR/main.rs:6:21
|
||||
|
|
||||
LL | pub fn bar() -> Foo {
|
||||
| ^^^ help: use the applicable keyword: `Self`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/main.rs:1:9
|
||||
|
|
||||
LL | #![deny(clippy::use_self)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
8
tests/ui-cargo/cargo_rust_version/fail_cargo/Cargo.toml
Normal file
8
tests/ui-cargo/cargo_rust_version/fail_cargo/Cargo.toml
Normal file
@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "fail-cargo"
|
||||
version = "0.1.0"
|
||||
rust-version = "1.56.1"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
11
tests/ui-cargo/cargo_rust_version/fail_cargo/src/main.rs
Normal file
11
tests/ui-cargo/cargo_rust_version/fail_cargo/src/main.rs
Normal file
@ -0,0 +1,11 @@
|
||||
#![deny(clippy::use_self)]
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
impl Foo {
|
||||
pub fn bar() -> Foo {
|
||||
Foo
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
14
tests/ui-cargo/cargo_rust_version/fail_cargo/src/main.stderr
Normal file
14
tests/ui-cargo/cargo_rust_version/fail_cargo/src/main.stderr
Normal file
@ -0,0 +1,14 @@
|
||||
error: unnecessary structure name repetition
|
||||
--> $DIR/main.rs:6:21
|
||||
|
|
||||
LL | pub fn bar() -> Foo {
|
||||
| ^^^ help: use the applicable keyword: `Self`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/main.rs:1:9
|
||||
|
|
||||
LL | #![deny(clippy::use_self)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
7
tests/ui-cargo/cargo_rust_version/fail_clippy/Cargo.toml
Normal file
7
tests/ui-cargo/cargo_rust_version/fail_clippy/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "fail-clippy"
|
||||
version = "0.1.0"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
@ -0,0 +1 @@
|
||||
msrv = "1.58"
|
11
tests/ui-cargo/cargo_rust_version/fail_clippy/src/main.rs
Normal file
11
tests/ui-cargo/cargo_rust_version/fail_clippy/src/main.rs
Normal file
@ -0,0 +1,11 @@
|
||||
#![deny(clippy::use_self)]
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
impl Foo {
|
||||
pub fn bar() -> Foo {
|
||||
Foo
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,14 @@
|
||||
error: unnecessary structure name repetition
|
||||
--> $DIR/main.rs:6:21
|
||||
|
|
||||
LL | pub fn bar() -> Foo {
|
||||
| ^^^ help: use the applicable keyword: `Self`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/main.rs:1:9
|
||||
|
|
||||
LL | #![deny(clippy::use_self)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "fail-file-attr"
|
||||
version = "0.1.0"
|
||||
rust-version = "1.13"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
@ -0,0 +1 @@
|
||||
msrv = "1.13.0"
|
16
tests/ui-cargo/cargo_rust_version/fail_file_attr/src/main.rs
Normal file
16
tests/ui-cargo/cargo_rust_version/fail_file_attr/src/main.rs
Normal file
@ -0,0 +1,16 @@
|
||||
// FIXME: this should produce a warning, because the attribute says 1.58 and the cargo.toml file
|
||||
// says 1.13
|
||||
|
||||
#![feature(custom_inner_attributes)]
|
||||
#![clippy::msrv = "1.58.0"]
|
||||
#![deny(clippy::use_self)]
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
impl Foo {
|
||||
pub fn bar() -> Foo {
|
||||
Foo
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,14 @@
|
||||
error: unnecessary structure name repetition
|
||||
--> $DIR/main.rs:11:21
|
||||
|
|
||||
LL | pub fn bar() -> Foo {
|
||||
| ^^^ help: use the applicable keyword: `Self`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/main.rs:6:9
|
||||
|
|
||||
LL | #![deny(clippy::use_self)]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "fail-both-same"
|
||||
version = "0.1.0"
|
||||
rust-version = "1.13.0"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
@ -0,0 +1 @@
|
||||
msrv = "1.13"
|
11
tests/ui-cargo/cargo_rust_version/pass_both_same/src/main.rs
Normal file
11
tests/ui-cargo/cargo_rust_version/pass_both_same/src/main.rs
Normal file
@ -0,0 +1,11 @@
|
||||
#![deny(clippy::use_self)]
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
impl Foo {
|
||||
pub fn bar() -> Foo {
|
||||
Foo
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
8
tests/ui-cargo/cargo_rust_version/pass_cargo/Cargo.toml
Normal file
8
tests/ui-cargo/cargo_rust_version/pass_cargo/Cargo.toml
Normal file
@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "fail-cargo"
|
||||
version = "0.1.0"
|
||||
rust-version = "1.13.0"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
11
tests/ui-cargo/cargo_rust_version/pass_cargo/src/main.rs
Normal file
11
tests/ui-cargo/cargo_rust_version/pass_cargo/src/main.rs
Normal file
@ -0,0 +1,11 @@
|
||||
#![deny(clippy::use_self)]
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
impl Foo {
|
||||
pub fn bar() -> Foo {
|
||||
Foo
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
7
tests/ui-cargo/cargo_rust_version/pass_clippy/Cargo.toml
Normal file
7
tests/ui-cargo/cargo_rust_version/pass_clippy/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "fail-clippy"
|
||||
version = "0.1.0"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
@ -0,0 +1 @@
|
||||
msrv = "1.13"
|
11
tests/ui-cargo/cargo_rust_version/pass_clippy/src/main.rs
Normal file
11
tests/ui-cargo/cargo_rust_version/pass_clippy/src/main.rs
Normal file
@ -0,0 +1,11 @@
|
||||
#![deny(clippy::use_self)]
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
impl Foo {
|
||||
pub fn bar() -> Foo {
|
||||
Foo
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "fail-file-attr"
|
||||
version = "0.1.0"
|
||||
rust-version = "1.59"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
13
tests/ui-cargo/cargo_rust_version/pass_file_attr/src/main.rs
Normal file
13
tests/ui-cargo/cargo_rust_version/pass_file_attr/src/main.rs
Normal file
@ -0,0 +1,13 @@
|
||||
#![feature(custom_inner_attributes)]
|
||||
#![clippy::msrv = "1.13.0"]
|
||||
#![deny(clippy::use_self)]
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
impl Foo {
|
||||
pub fn bar() -> Foo {
|
||||
Foo
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,8 @@
|
||||
[package]
|
||||
name = "warn-both-diff"
|
||||
version = "0.1.0"
|
||||
rust-version = "1.56.0"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
@ -0,0 +1 @@
|
||||
msrv = "1.13"
|
11
tests/ui-cargo/cargo_rust_version/warn_both_diff/src/main.rs
Normal file
11
tests/ui-cargo/cargo_rust_version/warn_both_diff/src/main.rs
Normal file
@ -0,0 +1,11 @@
|
||||
#![deny(clippy::use_self)]
|
||||
|
||||
pub struct Foo;
|
||||
|
||||
impl Foo {
|
||||
pub fn bar() -> Foo {
|
||||
Foo
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,4 @@
|
||||
warning: the MSRV in `clippy.toml` and `Cargo.toml` differ; using `1.13.0` from `clippy.toml`
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
Loading…
Reference in New Issue
Block a user