Skip to content

Commit

Permalink
stopped variable shadowing, multiple misspellings per attr
Browse files Browse the repository at this point in the history
  • Loading branch information
sinistersnare committed Nov 20, 2014
1 parent e18b573 commit 4861101
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/spellck/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,17 @@ impl<'a> SpellingVisitor<'a> {
fn check_subwords(&mut self, whole: &str, mut pos: Position) {
for w in words::subwords(whole) {
if !self.raw_word_is_correct(w) {
let w = w.to_string();
let ws = w.into_string();
let amt = whole.subslice_offset(w);
pos.span.lo = pos.span.lo + BytePos(amt as u32);
pos.span.hi = pos.span.lo + BytePos(amt as u32 + w.len() as u32);

if let Some(v) = self.misspellings.get_mut(&pos) {
v.push(w);
v.push(ws);
continue
}

if let Some(amt) = whole.find_str(w.as_slice()) {
pos.span.lo = pos.span.lo + BytePos(amt as u32);
pos.span.hi = pos.span.lo + BytePos(w.len() as u32);
}
self.misspellings.insert(pos, vec![w]);
self.misspellings.insert(pos, vec![ws]);
}
}
}
Expand Down

0 comments on commit 4861101

Please sign in to comment.