Skip to content

Commit 2ef151b

Browse files
committed
fix: Emit inline help after first snippet
1 parent eec0473 commit 2ef151b

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/cargo/util/lints.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ fn verify_feature_enabled(
177177
.annotation(Level::Error.span(lint_span.key).label(&label))
178178
.fold(true),
179179
)
180-
.footer(inherited_note)
181180
.footer(Level::Help.title(&help))
181+
.footer(inherited_note)
182182
};
183183

184184
*error_count += 1;
@@ -545,6 +545,9 @@ fn output_unknown_lints(
545545
emitted_source = Some(UNKNOWN_LINTS.emitted_source(lint_level, reason));
546546
footers.push(Level::Note.title(emitted_source.as_ref().unwrap()));
547547
}
548+
if let Some(help) = help.as_ref() {
549+
footers.push(Level::Help.title(help));
550+
}
548551

549552
let mut message = if let Some(span) =
550553
get_key_value_span(manifest.document(), &["lints", "cargo", lint_name])
@@ -588,9 +591,6 @@ fn output_unknown_lints(
588591
)
589592
};
590593

591-
if let Some(help) = help.as_ref() {
592-
footers.push(Level::Help.title(help));
593-
}
594594
for footer in footers {
595595
message = message.footer(footer);
596596
}

tests/testsuite/lints/inherited/stderr.term.svg

Lines changed: 7 additions & 7 deletions
Loading

tests/testsuite/lints/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,26 +299,26 @@ workspace = true
299299
6 | im_a_teapot = { level = "warn", priority = 10 }
300300
| ^^^^^^^^^^^ this is behind `test-dummy-unstable`, which is not enabled
301301
|
302+
= [HELP] consider adding `cargo-features = ["test-dummy-unstable"]` to the top of the manifest
302303
[NOTE] `cargo::im_a_teapot` was inherited
303304
--> foo/Cargo.toml:9:1
304305
|
305306
9 | workspace = true
306307
| ----------------
307308
|
308-
= [HELP] consider adding `cargo-features = ["test-dummy-unstable"]` to the top of the manifest
309309
[ERROR] use of unstable lint `test_dummy_unstable`
310310
--> Cargo.toml:7:1
311311
|
312312
7 | test_dummy_unstable = { level = "forbid", priority = -1 }
313313
| ^^^^^^^^^^^^^^^^^^^ this is behind `test-dummy-unstable`, which is not enabled
314314
|
315+
= [HELP] consider adding `cargo-features = ["test-dummy-unstable"]` to the top of the manifest
315316
[NOTE] `cargo::test_dummy_unstable` was inherited
316317
--> foo/Cargo.toml:9:1
317318
|
318319
9 | workspace = true
319320
| ----------------
320321
|
321-
= [HELP] consider adding `cargo-features = ["test-dummy-unstable"]` to the top of the manifest
322322
[ERROR] encountered 2 errors(s) while verifying lints
323323
324324
"#]])

0 commit comments

Comments
 (0)