Skip to content

Commit d153619

Browse files
committed
test: Migrate unused_optional_dependencies to snapshot
1 parent a88459e commit d153619

File tree

1 file changed

+45
-51
lines changed

1 file changed

+45
-51
lines changed

tests/testsuite/lints/unused_optional_dependencies.rs

Lines changed: 45 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(deprecated)]
2-
31
use cargo_test_support::project;
42
use cargo_test_support::registry::Package;
53
use cargo_test_support::str;
@@ -34,34 +32,33 @@ target-dep = { version = "0.1.0", optional = true }
3432

3533
p.cargo("check -Zcargo-lints")
3634
.masquerade_as_nightly_cargo(&["cargo-lints", "edition2024"])
37-
.with_stderr(
38-
"\
39-
warning: unused optional dependency
35+
.with_stderr_data(str![[r#"
36+
[WARNING] unused optional dependency
4037
--> Cargo.toml:9:1
4138
|
42-
9 | bar = { version = \"0.1.0\", optional = true }
39+
9 | bar = { version = "0.1.0", optional = true }
4340
| ---
4441
|
45-
= note: `cargo::unused_optional_dependency` is set to `warn` by default
46-
= help: remove the dependency or activate it in a feature with `dep:bar`
47-
warning: unused optional dependency
42+
= [NOTE] `cargo::unused_optional_dependency` is set to `warn` by default
43+
= [HELP] remove the dependency or activate it in a feature with `dep:bar`
44+
[WARNING] unused optional dependency
4845
--> Cargo.toml:12:1
4946
|
50-
12 | baz = { version = \"0.1.0\", optional = true }
47+
12 | baz = { version = "0.1.0", optional = true }
5148
| ---
5249
|
53-
= help: remove the dependency or activate it in a feature with `dep:baz`
54-
warning: unused optional dependency
50+
= [HELP] remove the dependency or activate it in a feature with `dep:baz`
51+
[WARNING] unused optional dependency
5552
--> Cargo.toml:15:1
5653
|
57-
15 | target-dep = { version = \"0.1.0\", optional = true }
54+
15 | target-dep = { version = "0.1.0", optional = true }
5855
| ----------
5956
|
60-
= help: remove the dependency or activate it in a feature with `dep:target-dep`
61-
[CHECKING] foo v0.1.0 ([CWD])
62-
[FINISHED] [..]
63-
",
64-
)
57+
= [HELP] remove the dependency or activate it in a feature with `dep:target-dep`
58+
[CHECKING] foo v0.1.0 ([ROOT]/foo)
59+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
60+
61+
"#]])
6562
.run();
6663
}
6764

@@ -89,14 +86,13 @@ implicit_features = "allow"
8986

9087
p.cargo("check -Zcargo-lints")
9188
.masquerade_as_nightly_cargo(&["cargo-lints"])
92-
.with_stderr(
93-
"\
94-
[UPDATING] [..]
89+
.with_stderr_data(str![[r#"
90+
[UPDATING] `dummy-registry` index
9591
[LOCKING] 2 packages to latest compatible versions
96-
[CHECKING] foo v0.1.0 ([CWD])
97-
[FINISHED] [..]
98-
",
99-
)
92+
[CHECKING] foo v0.1.0 ([ROOT]/foo)
93+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
94+
95+
"#]])
10096
.run();
10197
}
10298

@@ -130,34 +126,33 @@ target-dep = { version = "0.1.0", optional = true }
130126

131127
p.cargo("check -Zcargo-lints")
132128
.masquerade_as_nightly_cargo(&["cargo-lints", "edition2024"])
133-
.with_stderr(
134-
"\
135-
warning: unused optional dependency
129+
.with_stderr_data(str![[r#"
130+
[WARNING] unused optional dependency
136131
--> Cargo.toml:9:1
137132
|
138-
9 | bar = { version = \"0.1.0\", optional = true }
133+
9 | bar = { version = "0.1.0", optional = true }
139134
| ---
140135
|
141-
= note: `cargo::unused_optional_dependency` is set to `warn` by default
142-
= help: remove the dependency or activate it in a feature with `dep:bar`
143-
warning: unused optional dependency
136+
= [NOTE] `cargo::unused_optional_dependency` is set to `warn` by default
137+
= [HELP] remove the dependency or activate it in a feature with `dep:bar`
138+
[WARNING] unused optional dependency
144139
--> Cargo.toml:12:1
145140
|
146-
12 | baz = { version = \"0.2.0\", package = \"bar\", optional = true }
141+
12 | baz = { version = "0.2.0", package = "bar", optional = true }
147142
| ---
148143
|
149-
= help: remove the dependency or activate it in a feature with `dep:baz`
150-
warning: unused optional dependency
144+
= [HELP] remove the dependency or activate it in a feature with `dep:baz`
145+
[WARNING] unused optional dependency
151146
--> Cargo.toml:15:1
152147
|
153-
15 | target-dep = { version = \"0.1.0\", optional = true }
148+
15 | target-dep = { version = "0.1.0", optional = true }
154149
| ----------
155150
|
156-
= help: remove the dependency or activate it in a feature with `dep:target-dep`
157-
[CHECKING] foo v0.1.0 ([CWD])
158-
[FINISHED] [..]
159-
",
160-
)
151+
= [HELP] remove the dependency or activate it in a feature with `dep:target-dep`
152+
[CHECKING] foo v0.1.0 ([ROOT]/foo)
153+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
154+
155+
"#]])
161156
.run();
162157
}
163158

@@ -186,20 +181,19 @@ optional-dep = []
186181

187182
p.cargo("check -Zcargo-lints")
188183
.masquerade_as_nightly_cargo(&["cargo-lints", "edition2024"])
189-
.with_stderr(
190-
"\
191-
warning: unused optional dependency
184+
.with_stderr_data(str![[r#"
185+
[WARNING] unused optional dependency
192186
--> Cargo.toml:9:1
193187
|
194-
9 | optional-dep = { version = \"0.1.0\", optional = true }
188+
9 | optional-dep = { version = "0.1.0", optional = true }
195189
| ------------
196190
|
197-
= note: `cargo::unused_optional_dependency` is set to `warn` by default
198-
= help: remove the dependency or activate it in a feature with `dep:optional-dep`
199-
[CHECKING] foo v0.1.0 ([CWD])
200-
[FINISHED] [..]
201-
",
202-
)
191+
= [NOTE] `cargo::unused_optional_dependency` is set to `warn` by default
192+
= [HELP] remove the dependency or activate it in a feature with `dep:optional-dep`
193+
[CHECKING] foo v0.1.0 ([ROOT]/foo)
194+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
195+
196+
"#]])
203197
.run();
204198
}
205199

0 commit comments

Comments
 (0)