mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
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
This commit is contained in:
commit
132b4e5d16
@ -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))
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user