Skip to content

Commit ef1536e

Browse files
Follow guidelines for lint suggestions
1 parent 53dcec8 commit ef1536e

File tree

4 files changed

+33
-29
lines changed

4 files changed

+33
-29
lines changed

src/librustdoc/html/markdown.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,8 @@ impl LangString {
12891289
&& let Some(extra) = extra
12901290
{
12911291
extra.error_invalid_codeblock_attr(format!(
1292-
"unknown attribute `{x}`. Did you mean `edition{}`?",
1292+
"unknown attribute `{x}`. There is an attribute with a similar \
1293+
name: `edition{}`?",
12931294
&x[4..]
12941295
));
12951296
}
@@ -1338,7 +1339,10 @@ impl LangString {
13381339
} {
13391340
if let Some(extra) = extra {
13401341
extra.error_invalid_codeblock_attr_with_help(
1341-
format!("unknown attribute `{x}`. Did you mean `{flag}`?"),
1342+
format!(
1343+
"unknown attribute `{x}`. There is an attribute with a \
1344+
similar name: `{flag}`?"
1345+
),
13421346
help,
13431347
);
13441348
}

tests/rustdoc-ui/doctest/check-attr-test.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: unknown attribute `compile-fail`. Did you mean `compile_fail`?
1+
error: unknown attribute `compile-fail`. There is an attribute with a similar name: `compile_fail`?
22
--> $DIR/check-attr-test.rs:5:1
33
|
44
5 | / /// foo
@@ -15,7 +15,7 @@ note: the lint level is defined here
1515
3 | #![deny(rustdoc::invalid_codeblock_attributes)]
1616
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1717

18-
error: unknown attribute `compilefail`. Did you mean `compile_fail`?
18+
error: unknown attribute `compilefail`. There is an attribute with a similar name: `compile_fail`?
1919
--> $DIR/check-attr-test.rs:5:1
2020
|
2121
5 | / /// foo
@@ -27,7 +27,7 @@ error: unknown attribute `compilefail`. Did you mean `compile_fail`?
2727
|
2828
= help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully
2929

30-
error: unknown attribute `comPile_fail`. Did you mean `compile_fail`?
30+
error: unknown attribute `comPile_fail`. There is an attribute with a similar name: `compile_fail`?
3131
--> $DIR/check-attr-test.rs:5:1
3232
|
3333
5 | / /// foo
@@ -39,7 +39,7 @@ error: unknown attribute `comPile_fail`. Did you mean `compile_fail`?
3939
|
4040
= help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully
4141

42-
error: unknown attribute `should-panic`. Did you mean `should_panic`?
42+
error: unknown attribute `should-panic`. There is an attribute with a similar name: `should_panic`?
4343
--> $DIR/check-attr-test.rs:12:1
4444
|
4545
12 | / /// bar
@@ -51,7 +51,7 @@ error: unknown attribute `should-panic`. Did you mean `should_panic`?
5151
|
5252
= help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running
5353

54-
error: unknown attribute `shouldpanic`. Did you mean `should_panic`?
54+
error: unknown attribute `shouldpanic`. There is an attribute with a similar name: `should_panic`?
5555
--> $DIR/check-attr-test.rs:12:1
5656
|
5757
12 | / /// bar
@@ -63,7 +63,7 @@ error: unknown attribute `shouldpanic`. Did you mean `should_panic`?
6363
|
6464
= help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running
6565

66-
error: unknown attribute `shOuld_panic`. Did you mean `should_panic`?
66+
error: unknown attribute `shOuld_panic`. There is an attribute with a similar name: `should_panic`?
6767
--> $DIR/check-attr-test.rs:12:1
6868
|
6969
12 | / /// bar
@@ -75,7 +75,7 @@ error: unknown attribute `shOuld_panic`. Did you mean `should_panic`?
7575
|
7676
= help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running
7777

78-
error: unknown attribute `no-run`. Did you mean `no_run`?
78+
error: unknown attribute `no-run`. There is an attribute with a similar name: `no_run`?
7979
--> $DIR/check-attr-test.rs:19:1
8080
|
8181
19 | / /// foobar
@@ -87,7 +87,7 @@ error: unknown attribute `no-run`. Did you mean `no_run`?
8787
|
8888
= help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want)
8989

90-
error: unknown attribute `norun`. Did you mean `no_run`?
90+
error: unknown attribute `norun`. There is an attribute with a similar name: `no_run`?
9191
--> $DIR/check-attr-test.rs:19:1
9292
|
9393
19 | / /// foobar
@@ -99,7 +99,7 @@ error: unknown attribute `norun`. Did you mean `no_run`?
9999
|
100100
= help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want)
101101

102-
error: unknown attribute `nO_run`. Did you mean `no_run`?
102+
error: unknown attribute `nO_run`. There is an attribute with a similar name: `no_run`?
103103
--> $DIR/check-attr-test.rs:19:1
104104
|
105105
19 | / /// foobar
@@ -111,7 +111,7 @@ error: unknown attribute `nO_run`. Did you mean `no_run`?
111111
|
112112
= help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want)
113113

114-
error: unknown attribute `test-harness`. Did you mean `test_harness`?
114+
error: unknown attribute `test-harness`. There is an attribute with a similar name: `test_harness`?
115115
--> $DIR/check-attr-test.rs:26:1
116116
|
117117
26 | / /// b
@@ -123,7 +123,7 @@ error: unknown attribute `test-harness`. Did you mean `test_harness`?
123123
|
124124
= help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function
125125

126-
error: unknown attribute `testharness`. Did you mean `test_harness`?
126+
error: unknown attribute `testharness`. There is an attribute with a similar name: `test_harness`?
127127
--> $DIR/check-attr-test.rs:26:1
128128
|
129129
26 | / /// b
@@ -135,7 +135,7 @@ error: unknown attribute `testharness`. Did you mean `test_harness`?
135135
|
136136
= help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function
137137

138-
error: unknown attribute `tesT_harness`. Did you mean `test_harness`?
138+
error: unknown attribute `tesT_harness`. There is an attribute with a similar name: `test_harness`?
139139
--> $DIR/check-attr-test.rs:26:1
140140
|
141141
26 | / /// b

tests/rustdoc-ui/lints/check-attr.stderr

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: unknown attribute `compile-fail`. Did you mean `compile_fail`?
1+
error: unknown attribute `compile-fail`. There is an attribute with a similar name: `compile_fail`?
22
--> $DIR/check-attr.rs:3:1
33
|
44
LL | / /// foo
@@ -17,7 +17,7 @@ note: the lint level is defined here
1717
LL | #![deny(rustdoc::invalid_codeblock_attributes)]
1818
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1919

20-
error: unknown attribute `compilefail`. Did you mean `compile_fail`?
20+
error: unknown attribute `compilefail`. There is an attribute with a similar name: `compile_fail`?
2121
--> $DIR/check-attr.rs:3:1
2222
|
2323
LL | / /// foo
@@ -31,7 +31,7 @@ LL | | /// ```
3131
|
3232
= help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully
3333

34-
error: unknown attribute `comPile_fail`. Did you mean `compile_fail`?
34+
error: unknown attribute `comPile_fail`. There is an attribute with a similar name: `compile_fail`?
3535
--> $DIR/check-attr.rs:3:1
3636
|
3737
LL | / /// foo
@@ -45,7 +45,7 @@ LL | | /// ```
4545
|
4646
= help: the code block will either not be tested if not marked as a rust one or won't fail if it compiles successfully
4747

48-
error: unknown attribute `should-panic`. Did you mean `should_panic`?
48+
error: unknown attribute `should-panic`. There is an attribute with a similar name: `should_panic`?
4949
--> $DIR/check-attr.rs:13:1
5050
|
5151
LL | / /// bar
@@ -59,7 +59,7 @@ LL | | /// ```
5959
|
6060
= help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running
6161

62-
error: unknown attribute `shouldpanic`. Did you mean `should_panic`?
62+
error: unknown attribute `shouldpanic`. There is an attribute with a similar name: `should_panic`?
6363
--> $DIR/check-attr.rs:13:1
6464
|
6565
LL | / /// bar
@@ -73,7 +73,7 @@ LL | | /// ```
7373
|
7474
= help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running
7575

76-
error: unknown attribute `sHould_panic`. Did you mean `should_panic`?
76+
error: unknown attribute `sHould_panic`. There is an attribute with a similar name: `should_panic`?
7777
--> $DIR/check-attr.rs:13:1
7878
|
7979
LL | / /// bar
@@ -87,7 +87,7 @@ LL | | /// ```
8787
|
8888
= help: the code block will either not be tested if not marked as a rust one or won't fail if it doesn't panic when running
8989

90-
error: unknown attribute `no-run`. Did you mean `no_run`?
90+
error: unknown attribute `no-run`. There is an attribute with a similar name: `no_run`?
9191
--> $DIR/check-attr.rs:23:1
9292
|
9393
LL | / /// foobar
@@ -101,7 +101,7 @@ LL | | /// ```
101101
|
102102
= help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want)
103103

104-
error: unknown attribute `norun`. Did you mean `no_run`?
104+
error: unknown attribute `norun`. There is an attribute with a similar name: `no_run`?
105105
--> $DIR/check-attr.rs:23:1
106106
|
107107
LL | / /// foobar
@@ -115,7 +115,7 @@ LL | | /// ```
115115
|
116116
= help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want)
117117

118-
error: unknown attribute `no_Run`. Did you mean `no_run`?
118+
error: unknown attribute `no_Run`. There is an attribute with a similar name: `no_run`?
119119
--> $DIR/check-attr.rs:23:1
120120
|
121121
LL | / /// foobar
@@ -129,7 +129,7 @@ LL | | /// ```
129129
|
130130
= help: the code block will either not be tested if not marked as a rust one or will be run (which you might not want)
131131

132-
error: unknown attribute `test-harness`. Did you mean `test_harness`?
132+
error: unknown attribute `test-harness`. There is an attribute with a similar name: `test_harness`?
133133
--> $DIR/check-attr.rs:33:1
134134
|
135135
LL | / /// b
@@ -143,7 +143,7 @@ LL | | /// ```
143143
|
144144
= help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function
145145

146-
error: unknown attribute `testharness`. Did you mean `test_harness`?
146+
error: unknown attribute `testharness`. There is an attribute with a similar name: `test_harness`?
147147
--> $DIR/check-attr.rs:33:1
148148
|
149149
LL | / /// b
@@ -157,7 +157,7 @@ LL | | /// ```
157157
|
158158
= help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function
159159

160-
error: unknown attribute `teSt_harness`. Did you mean `test_harness`?
160+
error: unknown attribute `teSt_harness`. There is an attribute with a similar name: `test_harness`?
161161
--> $DIR/check-attr.rs:33:1
162162
|
163163
LL | / /// b
@@ -171,7 +171,7 @@ LL | | /// ```
171171
|
172172
= help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function
173173

174-
error: unknown attribute `rust2018`. Did you mean `edition2018`?
174+
error: unknown attribute `rust2018`. There is an attribute with a similar name: `edition2018`?
175175
--> $DIR/check-attr.rs:43:1
176176
|
177177
LL | / /// b

tests/rustdoc-ui/lints/check-fail.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ note: the lint level is defined here
2222
LL | #![deny(rustdoc::missing_doc_code_examples)]
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2424

25-
error: unknown attribute `testharness`. Did you mean `test_harness`?
25+
error: unknown attribute `testharness`. There is an attribute with a similar name: `test_harness`?
2626
--> $DIR/check-fail.rs:8:1
2727
|
2828
LL | / //! ```rust,testharness
@@ -39,7 +39,7 @@ LL | #![deny(rustdoc::all)]
3939
| ^^^^^^^^^^^^
4040
= note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(rustdoc::all)]`
4141

42-
error: unknown attribute `testharness`. Did you mean `test_harness`?
42+
error: unknown attribute `testharness`. There is an attribute with a similar name: `test_harness`?
4343
--> $DIR/check-fail.rs:17:1
4444
|
4545
LL | / /// hello

0 commit comments

Comments
 (0)