diff options
| author | bors <bors@rust-lang.org> | 2016-07-04 02:18:46 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-04 02:18:46 -0700 |
| commit | d508de6cf7c7bb9b5057ee63432dbbc899209101 (patch) | |
| tree | 972fd7fd823fc411d3d3a175bbae46dee2f6d71b /src/libcore | |
| parent | d98da85c5cfd2546ac711701cecc05b093242a26 (diff) | |
| parent | d37edef9dd088d953c5e272db37686a338c31778 (diff) | |
| download | rust-d508de6cf7c7bb9b5057ee63432dbbc899209101.tar.gz rust-d508de6cf7c7bb9b5057ee63432dbbc899209101.zip | |
Auto merge of #34638 - zackmdavis:if_let_over_none_empty_block_arm, r=jseyfried
prefer `if let` to match with `None => {}` arm in some places
This is a spiritual succesor to #34268 / 8531d581, in which we replaced a
number of matches of None to the unit value with `if let` conditionals
where it was judged that this made for clearer/simpler code (as would be
recommended by Manishearth/rust-clippy's `single_match` lint). The same
rationale applies to matches of None to the empty block.
----
r? @jseyfried
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/fmt/mod.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 4ac134c2b59..895a679fc3d 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -840,11 +840,8 @@ pub fn write(output: &mut Write, args: Arguments) -> Result { } // There can be only one trailing string piece left. - match pieces.next() { - Some(piece) => { - formatter.buf.write_str(*piece)?; - } - None => {} + if let Some(piece) = pieces.next() { + formatter.buf.write_str(*piece)?; } Ok(()) |
