diff options
| author | Thomas Jespersen <laumann.thomas@gmail.com> | 2017-09-21 13:04:11 +0200 |
|---|---|---|
| committer | Thomas Jespersen <laumann.thomas@gmail.com> | 2017-09-24 20:00:02 +0200 |
| commit | 4963394f86719f3315239a900e557982a829adae (patch) | |
| tree | fb9919fad86152e727cafff6bbb83c5362ded4c4 /src/test/ui | |
| parent | 09defbcb5b733773c516a31f0206d344e6555f72 (diff) | |
| download | rust-4963394f86719f3315239a900e557982a829adae.tar.gz rust-4963394f86719f3315239a900e557982a829adae.zip | |
Change Levensthein-based method to a single suggestion
The convention for suggesting close matches is to provide at most one match (the closest one). Change the suggestions for misspelt method names to obey that.
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/suggestions/suggest-methods.rs | 8 | ||||
| -rw-r--r-- | src/test/ui/suggestions/suggest-methods.stderr | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/test/ui/suggestions/suggest-methods.rs b/src/test/ui/suggestions/suggest-methods.rs index 36b9976ae56..b02881dc7ee 100644 --- a/src/test/ui/suggestions/suggest-methods.rs +++ b/src/test/ui/suggestions/suggest-methods.rs @@ -30,9 +30,11 @@ fn main() { let s = "foo".to_string(); let _ = s.is_emtpy(); - // Generates a warning, both for count_ones and count_zeros + // Generates a warning for `count_zeros()`. `count_ones()` is also a close + // match, but the former is closer. let _ = 63u32.count_eos(); - let _ = 63u32.count_o(); // Does not generate a warning -} + // Does not generate a warning + let _ = 63u32.count_o(); +} diff --git a/src/test/ui/suggestions/suggest-methods.stderr b/src/test/ui/suggestions/suggest-methods.stderr index d1a5ebcdef4..41beb73b1bc 100644 --- a/src/test/ui/suggestions/suggest-methods.stderr +++ b/src/test/ui/suggestions/suggest-methods.stderr @@ -5,7 +5,6 @@ error[E0599]: no method named `bat` found for type `Foo` in the current scope | ^^^ | = help: did you mean `bar`? - = help: did you mean `baz`? error[E0599]: no method named `is_emtpy` found for type `std::string::String` in the current scope --> $DIR/suggest-methods.rs:31:15 @@ -16,18 +15,17 @@ error[E0599]: no method named `is_emtpy` found for type `std::string::String` in = help: did you mean `is_empty`? error[E0599]: no method named `count_eos` found for type `u32` in the current scope - --> $DIR/suggest-methods.rs:34:19 + --> $DIR/suggest-methods.rs:35:19 | -34 | let _ = 63u32.count_eos(); +35 | let _ = 63u32.count_eos(); | ^^^^^^^^^ | - = help: did you mean `count_ones`? = help: did you mean `count_zeros`? error[E0599]: no method named `count_o` found for type `u32` in the current scope - --> $DIR/suggest-methods.rs:35:19 + --> $DIR/suggest-methods.rs:38:19 | -35 | let _ = 63u32.count_o(); // Does not generate a warning +38 | let _ = 63u32.count_o(); | ^^^^^^^ error: aborting due to 4 previous errors |
