Skip to content

Commit 21ee99e

Browse files
eucliomark-i-m
authored andcommitted
add suggestion style guide
The guide is based on [existing rustdoc]. [existing rustdoc]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.Diagnostic.html#method.span_suggestion
1 parent 175a18c commit 21ee99e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/diagnostics.md

+16
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,22 @@ The possible values of [`Applicability`][appl] are:
441441

442442
[appl]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/enum.Applicability.html
443443

444+
### Suggestion Style Guide
445+
446+
- Suggestions should not be a question. In particular, language like "did you
447+
mean" should be avoided. Sometimes, it's unclear why a particular suggestion
448+
is being made. In these cases, it's better to be upfront about what the
449+
suggestion is.
450+
451+
Compare "did you mean: `Foo`" vs. "there is a struct with a similar name: `Foo`".
452+
453+
- The message should not contain any phrases like "the following", "as shown",
454+
etc. Use the span to convey what is being talked about.
455+
- The message may contain further instruction such as "to do xyz, use" or "to do
456+
xyz, use abc".
457+
- The message may contain a name of a function, variable, or type, but avoid
458+
whole expressions.
459+
444460
## Lints
445461

446462
The compiler linting infrastructure is defined in the [`rustc::lint`][rlint]

0 commit comments

Comments
 (0)