This commit is contained in:
Manish Goregaokar 2016-02-29 16:49:32 +05:30
parent e256055dc4
commit bd45cfd273
18 changed files with 137 additions and 203 deletions

View file

@ -31,17 +31,16 @@ fn var2str(var: &Variant) -> InternedString {
var.node.name.name.as_str()
}
/*
FIXME: waiting for https://github.com/rust-lang/rust/pull/31700
fn partial_match(pre: &str, name: &str) -> usize {
// skip(1) to ensure that the prefix never takes the whole variant name
pre.chars().zip(name.chars().rev().skip(1).rev()).take_while(|&(l, r)| l == r).count()
}
fn partial_rmatch(post: &str, name: &str) -> usize {
// skip(1) to ensure that the postfix never takes the whole variant name
post.chars().rev().zip(name.chars().skip(1).rev()).take_while(|&(l, r)| l == r).count()
}*/
// FIXME: waiting for https://github.com/rust-lang/rust/pull/31700
// fn partial_match(pre: &str, name: &str) -> usize {
// // skip(1) to ensure that the prefix never takes the whole variant name
// pre.chars().zip(name.chars().rev().skip(1).rev()).take_while(|&(l, r)| l == r).count()
// }
//
// fn partial_rmatch(post: &str, name: &str) -> usize {
// // skip(1) to ensure that the postfix never takes the whole variant name
// post.chars().rev().zip(name.chars().skip(1).rev()).take_while(|&(l, r)| l == r).count()
// }
fn partial_match(pre: &str, name: &str) -> usize {
let mut name_iter = name.chars();
@ -99,7 +98,8 @@ impl EarlyLintPass for EnumVariantNames {
item.span,
&format!("All variants have the same {}fix: `{}`", what, value),
&format!("remove the {}fixes and use full paths to \
the variants instead of glob imports", what));
the variants instead of glob imports",
what));
}
}
}