don't say "did you mean to" - use the standard "consider..."

"Did you mean to ..." sounds a bit condescending to me, since
if I meant to write "if let" I probably wouldn't have written "match" :)
This commit is contained in:
Georg Brandl 2015-09-02 16:46:12 +02:00
parent a9869e6fe4
commit 846c164709
3 changed files with 8 additions and 9 deletions

View file

@ -92,7 +92,7 @@ fn main(){
Produce this warning:
```
src/main.rs:8:5: 11:6 warning: You seem to be trying to use match for destructuring a single type. Did you mean to use `if let`?, #[warn(single_match)] on by default
src/main.rs:8:5: 11:6 warning: you seem to be trying to use match for destructuring a single type. Consider using `if let`, #[warn(single_match)] on by default
src/main.rs:8 match x {
src/main.rs:9 Some(y) => println!("{:?}", y),
src/main.rs:10 _ => ()

View file

@ -37,9 +37,8 @@ impl LintPass for MatchPass {
{
if in_external_macro(cx, expr.span) {return;}
span_help_and_lint(cx, SINGLE_MATCH, expr.span,
"you seem to be trying to use match for \
destructuring a single pattern. Did you mean to \
use `if let`?",
"you seem to be trying to use match for destructuring a \
single pattern. Consider using `if let`",
&format!("try\nif let {} = {} {}",
snippet(cx, arms[0].pats[0].span, ".."),
snippet(cx, ex.span, ".."),

View file

@ -30,7 +30,7 @@ impl LintPass for TypePass {
if match_type(cx, inner, &VEC_PATH) {
span_help_and_lint(
cx, BOX_VEC, ast_ty.span,
"you seem to be trying to use `Box<Vec<T>>`. Did you mean to use `Vec<T>`?",
"you seem to be trying to use `Box<Vec<T>>`. Consider using just `Vec<T>`",
"`Vec<T>` is already on the heap, `Box<Vec<T>>` makes an extra allocation.");
}
}