diff options
| author | bors <bors@rust-lang.org> | 2021-04-13 18:04:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-04-13 18:04:20 +0000 |
| commit | 132b4e5d167b7e622fcc11fa2b67b931105b4de1 (patch) | |
| tree | 2582b4a7be38c6cb43f13507fecfdd47877f5c02 | |
| parent | 5c1304205b7bc53a1e9f48cf286a60438351c1ab (diff) | |
| parent | 28aed81f7d3c03aebfe23832593be9a1cb610257 (diff) | |
| download | rust-132b4e5d167b7e622fcc11fa2b67b931105b4de1.tar.gz rust-132b4e5d167b7e622fcc11fa2b67b931105b4de1.zip | |
Auto merge of #84164 - LingMan:option_option, r=estebank
Avoid an `Option<Option<_>>` By simply swapping the calls to `map` and `and_then` around the complexity of handling an `Option<Option<_>>` disappears. `@rustbot` modify labels +C-cleanup +T-compiler
| -rw-r--r-- | compiler/rustc_target/src/spec/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 57b0a36e009..2af46693449 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -1446,8 +1446,8 @@ impl Target { let get_req_field = |name: &str| { obj.find(name) - .map(|s| s.as_string()) - .and_then(|os| os.map(|s| s.to_string())) + .and_then(Json::as_string) + .map(str::to_string) .ok_or_else(|| format!("Field {} in target specification is required", name)) }; |
