From e85a0d70b86491752eb501f73b9d2025c5991e8e Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Wed, 16 Nov 2016 10:52:37 +0000 Subject: Use `Symbol` instead of `InternedString` in the AST, HIR, and various other places. --- src/libsyntax/util/lev_distance.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/libsyntax/util') 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) -> Option - where T: Iterator { + dist: Option) -> Option + where T: Iterator { 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, } }) -- cgit 1.4.1-3-g733a5