diff options
| author | kennytm <kennytm@gmail.com> | 2018-08-17 00:13:20 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-17 00:13:20 +0800 |
| commit | e6068828bddd8b756512e7f0af6d2126908c891f (patch) | |
| tree | a092b6d81d7763121b805b8bec735b9b2c38c1c9 /src/libserialize | |
| parent | 07ce2a35180bf7c8ce05ac45993ee34f65612b65 (diff) | |
| parent | 4cae6650fd9f25c4fb1338c896783193392be1af (diff) | |
| download | rust-e6068828bddd8b756512e7f0af6d2126908c891f.tar.gz rust-e6068828bddd8b756512e7f0af6d2126908c891f.zip | |
Rollup merge of #53313 - llogiq:two-small-improvements, r=estebank
Two small improvements In `librustc_apfloat/ieee.rs`, use the iterator.[r]find methods to simplify the code. In `libserialize/json.rs`, make use of the fact that `Vec.last` on an empty `Vec` returns `None` to simplify the code to a single match.
Diffstat (limited to 'src/libserialize')
| -rw-r--r-- | src/libserialize/json.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 00ccd062e0a..35ef6327de5 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -1390,10 +1390,9 @@ impl Stack { // Used by Parser to test whether the top-most element is an index. fn last_is_index(&self) -> bool { - if let Some(InternalIndex(_)) = self.stack.last() { - true - } else { - false + match self.stack.last() { + Some(InternalIndex(_)) => true, + _ => false, } } |
