Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make suggestions based on Damerau-Levenshtein distance #1824

Merged
merged 3 commits into from
May 9, 2019
Merged

Make suggestions based on Damerau-Levenshtein distance #1824

merged 3 commits into from
May 9, 2019

Conversation

Glamhoth
Copy link
Contributor

@Glamhoth Glamhoth commented May 1, 2019

#1816
The only change that I'd suggest is to use Damerau-Levenshtein distance instead of Levenshtein distance, because the former adds transpositions to list of the basic operations. And as we know a lot of misspellings are made that way, even the example from issue is of this kind of error.

Copy link
Contributor

@kinnison kinnison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not bad, some comments in-line, and the commit history will need a good rebase toward the end (be careful to retain retep007's authorship at that point).

In addition, I'd like to see at least one test which demonstrates what happens if there's nothing worth suggesting within the heuristic distance of 3. E.g. rustup component add banana.

src/toolchain.rs Outdated Show resolved Hide resolved
src/toolchain.rs Outdated Show resolved Hide resolved
src/errors.rs Outdated Show resolved Hide resolved
src/toolchain.rs Outdated Show resolved Hide resolved
@bors
Copy link
Contributor

bors commented May 7, 2019

☔ The latest upstream changes (presumably #1833) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Contributor

@kinnison kinnison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So very almost there. Please fold the requested changes into the two main commits you have (i.e. where your initial implementation, and retep's changes lie.

I'll expect to see:

  • commit 1: the clitools.rs update
  • commit 2: your code (with fixes folded in)
  • commit 3: retep's work (with fixes folded in)

If you can do that, I think this is mergeable, so remember to remove WIP: from the title when you think you're ready for the final review before merge 😁

Thanks,

D.

tests/cli-v2.rs Show resolved Hide resolved
tests/mock/clitools.rs Show resolved Hide resolved
@Glamhoth Glamhoth changed the title WIP: Make suggestions based on Damerau-Levenshtein distance Make suggestions based on Damerau-Levenshtein distance May 9, 2019
Glamhoth and others added 3 commits May 9, 2019 11:27
In order to support testing commands which may return certain
messages on `stderr` in a way in which they should *NOT*
produce such messages, add a counterpart to `expect_not_stdout_ok`.
@kinnison kinnison merged commit 6396345 into rust-lang:master May 9, 2019
@Glamhoth Glamhoth deleted the suggestions branch May 9, 2019 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants