1
Fork 0

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.
This commit is contained in:
kennytm 2018-08-17 00:13:20 +08:00 committed by GitHub
commit e6068828bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 18 deletions

View file

@ -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,
}
}