Commit 48a7fac 1 parent 363754a commit 48a7fac Copy full SHA for 48a7fac
File tree 5 files changed +41
-0
lines changed
test_crates/manifest_tests/only_read_new_manifest
5 files changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ [package ]
2
+ publish = false
3
+ name = " only-read-new-manifest"
4
+ version = " 0.1.0"
5
+ edition = " 2021"
6
+
7
+ [dependencies ]
Original file line number Diff line number Diff line change
1
+ // This will be removed in the `new` version to trigger the `struct_missing` lint.
2
+ // This is configured to `allow` in `old/Cargo.toml` (the baseline version),
3
+ // but this should not affect the lint level as the configuration should only be
4
+ // read from the `new` (current) manifest, so the `struct_missing` lint should
5
+ // still trigger.
6
+ // pub struct StructMissing;
Original file line number Diff line number Diff line change
1
+ [package ]
2
+ publish = false
3
+ name = " only-read-new-manifest"
4
+ version = " 0.1.0"
5
+ edition = " 2021"
6
+
7
+ [dependencies ]
8
+
9
+ [package .metadata .cargo-semver-checks .lints ]
10
+ struct_missing = " allow"
Original file line number Diff line number Diff line change
1
+ // This will be removed in the `new` version to trigger the `struct_missing` lint.
2
+ // This is configured to `allow` in `old/Cargo.toml` (the baseline version),
3
+ // but this should not affect the lint level as the configuration should only be
4
+ // read from the `new` (current) manifest, so the `struct_missing` lint should
5
+ // still trigger.
6
+ pub struct StructMissing ;
Original file line number Diff line number Diff line change @@ -128,3 +128,15 @@ fn test_workspace_key_cargo_true() {
128
128
fn test_workspace_key_both_missing ( ) {
129
129
test_workspace_key_overrided ( "both_missing" , false ) ;
130
130
}
131
+
132
+ /// Tests that config overrides are only read from the new/current
133
+ /// manifest and not the old/baseline manifest. In `old/Cargo.toml`,
134
+ /// `struct_missing` is configured to allow, but this should not apply
135
+ /// and the lint should still be triggered.
136
+ #[ test]
137
+ fn test_only_read_config_from_new_manifest ( ) {
138
+ let assert = command_for_crate ( "only_read_new_manifest" ) . assert ( ) ;
139
+ assert
140
+ . stderr ( predicates:: str:: is_match ( "FAIL(.*)struct_missing" ) . expect ( "regex should be valid" ) )
141
+ . failure ( ) ;
142
+ }
You can’t perform that action at this time.
0 commit comments