diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-11-16 10:52:37 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-11-21 09:00:55 +0000 |
| commit | e85a0d70b86491752eb501f73b9d2025c5991e8e (patch) | |
| tree | a88f0e13a62398369117b8d7246c6684be031758 /src/libsyntax/util | |
| parent | d2f8fb0a0a9dd98ea9d6a01620f1a21f425236c0 (diff) | |
| download | rust-e85a0d70b86491752eb501f73b9d2025c5991e8e.tar.gz rust-e85a0d70b86491752eb501f73b9d2025c5991e8e.zip | |
Use `Symbol` instead of `InternedString` in the AST, HIR, and various other places.
Diffstat (limited to 'src/libsyntax/util')
| -rw-r--r-- | src/libsyntax/util/lev_distance.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libsyntax/util/lev_distance.rs b/src/libsyntax/util/lev_distance.rs index 0d6df2cfcb6..a6fff2d7074 100644 --- a/src/libsyntax/util/lev_distance.rs +++ b/src/libsyntax/util/lev_distance.rs @@ -8,9 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use ast::Name; use std::cmp; -use symbol::InternedString; +use symbol::Symbol; /// To find the Levenshtein distance between two strings pub fn lev_distance(a: &str, b: &str) -> usize { @@ -48,14 +47,14 @@ pub fn lev_distance(a: &str, b: &str) -> usize { /// to one-third of the given word pub fn find_best_match_for_name<'a, T>(iter_names: T, lookup: &str, - dist: Option<usize>) -> Option<InternedString> - where T: Iterator<Item = &'a Name> { + dist: Option<usize>) -> Option<Symbol> + where T: Iterator<Item = &'a Symbol> { let max_dist = dist.map_or_else(|| cmp::max(lookup.len(), 3) / 3, |d| d); iter_names - .filter_map(|name| { + .filter_map(|&name| { let dist = lev_distance(lookup, &name.as_str()); match dist <= max_dist { // filter the unwanted cases - true => Some((name.as_str(), dist)), + true => Some((name, dist)), false => None, } }) |
