diff options
| author | Mark Simulacrum <mark.simulacrum@gmail.com> | 2017-05-16 17:31:50 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-16 17:31:50 -0600 |
| commit | 4066c8ec718d8338c2fd6e00cb63e03d3544bcd1 (patch) | |
| tree | 7c6d8f39d6a240fa52d1b33e67c16ffa51f5040e /src/libsyntax/util | |
| parent | 8f61055c529d12a04ee077ad42a80b9f9b952cb1 (diff) | |
| parent | 282b40249e158376fcc4682879be40fb80c4e36f (diff) | |
| download | rust-4066c8ec718d8338c2fd6e00cb63e03d3544bcd1.tar.gz rust-4066c8ec718d8338c2fd6e00cb63e03d3544bcd1.zip | |
Rollup merge of #41957 - llogiq:clippy-libsyntax, r=petrochenkov
Fix some clippy warnings in libsyntax This is mostly removing stray ampersands, needless returns and lifetimes. Basically a lot of small changes.
Diffstat (limited to 'src/libsyntax/util')
| -rw-r--r-- | src/libsyntax/util/lev_distance.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/util/move_map.rs | 8 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/libsyntax/util/lev_distance.rs b/src/libsyntax/util/lev_distance.rs index a6fff2d7074..9307f3c58d4 100644 --- a/src/libsyntax/util/lev_distance.rs +++ b/src/libsyntax/util/lev_distance.rs @@ -53,9 +53,10 @@ pub fn find_best_match_for_name<'a, T>(iter_names: T, iter_names .filter_map(|&name| { let dist = lev_distance(lookup, &name.as_str()); - match dist <= max_dist { // filter the unwanted cases - true => Some((name, dist)), - false => None, + if dist <= max_dist { // filter the unwanted cases + Some((name, dist)) + } else { + None } }) .min_by_key(|&(_, val)| val) // extract the tuple containing the minimum edit distance diff --git a/src/libsyntax/util/move_map.rs b/src/libsyntax/util/move_map.rs index fe05e2958b3..8cc37afa354 100644 --- a/src/libsyntax/util/move_map.rs +++ b/src/libsyntax/util/move_map.rs @@ -37,10 +37,10 @@ impl<T> MoveMap<T> for Vec<T> { // move the read_i'th item out of the vector and map it // to an iterator let e = ptr::read(self.get_unchecked(read_i)); - let mut iter = f(e).into_iter(); + let iter = f(e).into_iter(); read_i += 1; - while let Some(e) = iter.next() { + for e in iter { if write_i < read_i { ptr::write(self.get_unchecked_mut(write_i), e); write_i += 1; @@ -93,10 +93,10 @@ impl<T> MoveMap<T> for SmallVector<T> { // move the read_i'th item out of the vector and map it // to an iterator let e = ptr::read(self.get_unchecked(read_i)); - let mut iter = f(e).into_iter(); + let iter = f(e).into_iter(); read_i += 1; - while let Some(e) = iter.next() { + for e in iter { if write_i < read_i { ptr::write(self.get_unchecked_mut(write_i), e); write_i += 1; |
