Skip to content

Commit 476ce54

Browse files
David Tolnayfacebook-github-bot
David Tolnay
authored andcommitted
Resolve manual_ok_err clippy lint
Summary: ```lang=text warning: manual implementation of `ok` --> fbcode/buck2/app/buck2_error/src/error.rs:252:17 | 252 | / if let Ok(typed) = Arc::downcast(v.clone()) { 253 | | Some(typed) 254 | | } else { 255 | | None 256 | | } | |_________________^ help: replace with: `Arc::downcast(v.clone()).ok()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_err = note: `-W clippy::manual-ok-err` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::manual_ok_err)]` warning: manual implementation of `ok` --> fbcode/buck2/app/buck2_events/src/dispatch.rs:394:5 | 394 | / match EVENTS.try_with(|dispatcher| dispatcher.dupe()) { 395 | | Ok(dispatcher) => Some(dispatcher), 396 | | Err(..) => None, 397 | | } | |_____^ help: replace with: `EVENTS.try_with(|dispatcher| dispatcher.dupe()).ok()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_err = note: `-W clippy::manual-ok-err` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::manual_ok_err)]` warning: manual implementation of `ok` --> fbcode/buck2/app/buck2_server/src/daemon/disk_state.rs:115:30 | 115 | let materializer_state = match load_result { | ______________________________^ 116 | | Ok(s) => Some(s), ... | 120 | | Err(_e) => None, 121 | | }; | |_____^ help: replace with: `load_result.ok()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_err = note: `-W clippy::manual-ok-err` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::manual_ok_err)]` warning: manual implementation of `ok` --> fbcode/buck2/app/buck2_server_commands/src/commands/build.rs:261:69 | 261 | let mut outputs = v.outputs.into_iter().filter_map(|output| match output { | _____________________________________________________________________^ 262 | | Ok(output) => Some(output), 263 | | _ => None, 264 | | }); | |_________^ help: replace with: `output.ok()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_err = note: `-W clippy::manual-ok-err` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::manual_ok_err)]` warning: manual implementation of `ok` --> fbcode/buck2/starlark-rust/starlark/src/values/owned_frozen_ref.rs:113:9 | 113 | / match self.try_map_result(|x| f(x).ok_or(())) { 114 | | Ok(x) => Some(x), 115 | | Err(()) => None, 116 | | } | |_________^ help: replace with: `self.try_map_result(|x| f(x).ok_or(())).ok()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_err = note: `-W clippy::manual-ok-err` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::manual_ok_err)]` errors: 0; warnings: 5 ``` Reviewed By: diliop Differential Revision: D72737416 fbshipit-source-id: 481593ab24c4af5e59019ae6ebf84802ee5c05fd
1 parent ca667a2 commit 476ce54

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

starlark/src/values/owned_frozen_ref.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,7 @@ impl<'f, T: ?Sized> OwnedRefFrozenRef<'f, T> {
110110
where
111111
F: FnOnce(&'f T) -> Option<&'f U>,
112112
{
113-
match self.try_map_result(|x| f(x).ok_or(())) {
114-
Ok(x) => Some(x),
115-
Err(()) => None,
116-
}
113+
self.try_map_result(|x| f(x).ok_or(())).ok()
117114
}
118115
}
119116

0 commit comments

Comments
 (0)