Skip to content

Commit 132b4e5

Browse files
committed
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
2 parents 5c13042 + 28aed81 commit 132b4e5

File tree

1 file changed

+2
-2
lines changed
  • compiler/rustc_target/src/spec

1 file changed

+2
-2
lines changed

compiler/rustc_target/src/spec/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1446,8 +1446,8 @@ impl Target {
14461446

14471447
let get_req_field = |name: &str| {
14481448
obj.find(name)
1449-
.map(|s| s.as_string())
1450-
.and_then(|os| os.map(|s| s.to_string()))
1449+
.and_then(Json::as_string)
1450+
.map(str::to_string)
14511451
.ok_or_else(|| format!("Field {} in target specification is required", name))
14521452
};
14531453

0 commit comments

Comments
 (0)