From db50a9b5eba355b1918658fcb555bddf6fa1cea2 Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Fri, 10 Jan 2025 11:54:03 -0800 Subject: [PATCH] style: clippy cleanups for latest stable rust --- Cargo.lock | 25 +++++++++---------- .../src/graph/eliminate_extra_unions_tees.rs | 2 +- dfir_lang/src/graph/hydroflow_graph.rs | 2 +- dfir_rs/src/util/unsync/mpsc.rs | 6 ++--- lattices/src/with_bot.rs | 2 +- lattices/src/with_top.rs | 2 +- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d1c902907469..ab925ce13743 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -846,9 +846,9 @@ dependencies = [ [[package]] name = "ctor" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" +checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" dependencies = [ "quote", "syn 2.0.75", @@ -4245,9 +4245,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if", "once_cell", @@ -4256,13 +4256,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn 2.0.75", @@ -4283,9 +4282,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4293,9 +4292,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", @@ -4306,9 +4305,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "wasm-bindgen-test" diff --git a/dfir_lang/src/graph/eliminate_extra_unions_tees.rs b/dfir_lang/src/graph/eliminate_extra_unions_tees.rs index 400d120041c5..fa3a8ca786c8 100644 --- a/dfir_lang/src/graph/eliminate_extra_unions_tees.rs +++ b/dfir_lang/src/graph/eliminate_extra_unions_tees.rs @@ -13,7 +13,7 @@ fn find_unary_ops<'a>( .filter(move |&node_id| { graph .node_op_inst(node_id) - .map_or(false, |op_inst| op_name == op_inst.op_constraints.name) + .is_some_and(|op_inst| op_name == op_inst.op_constraints.name) }) .filter(|&node_id| { 1 == graph.node_degree_in(node_id) && 1 == graph.node_degree_out(node_id) diff --git a/dfir_lang/src/graph/hydroflow_graph.rs b/dfir_lang/src/graph/hydroflow_graph.rs index b3cb5c91e21c..c955f40e4707 100644 --- a/dfir_lang/src/graph/hydroflow_graph.rs +++ b/dfir_lang/src/graph/hydroflow_graph.rs @@ -718,7 +718,7 @@ impl DfirGraph { .iter() .position(|&node_id| { self.node_color(node_id) - .map_or(false, |color| Color::Pull != color) + .is_some_and(|color| Color::Pull != color) }) .unwrap_or(subgraph_nodes.len()) } diff --git a/dfir_rs/src/util/unsync/mpsc.rs b/dfir_rs/src/util/unsync/mpsc.rs index b4b8d802fb43..6a4732db596a 100644 --- a/dfir_rs/src/util/unsync/mpsc.rs +++ b/dfir_rs/src/util/unsync/mpsc.rs @@ -25,7 +25,7 @@ impl Sender { let mut shared = strong.borrow_mut(); if shared .capacity - .map_or(false, |cap| cap.get() <= shared.buffer.len()) + .is_some_and(|cap| cap.get() <= shared.buffer.len()) { // Full. shared.send_wakers.push(ctx.waker().clone()); @@ -53,7 +53,7 @@ impl Sender { let mut shared = strong.borrow_mut(); if shared .capacity - .map_or(false, |cap| cap.get() <= shared.buffer.len()) + .is_some_and(|cap| cap.get() <= shared.buffer.len()) { Err(TrySendError::Full(item)) } else { @@ -104,7 +104,7 @@ impl Sink for Sender { let mut shared = strong.borrow_mut(); if shared .capacity - .map_or(false, |cap| cap.get() <= shared.buffer.len()) + .is_some_and(|cap| cap.get() <= shared.buffer.len()) { // Full. shared.send_wakers.push(ctx.waker().clone()); diff --git a/lattices/src/with_bot.rs b/lattices/src/with_bot.rs index a30d8d3b1ad6..b5243fde63ec 100644 --- a/lattices/src/with_bot.rs +++ b/lattices/src/with_bot.rs @@ -138,7 +138,7 @@ where Inner: IsTop, { fn is_top(&self) -> bool { - self.0.as_ref().map_or(false, IsTop::is_top) + self.0.as_ref().is_some_and(IsTop::is_top) } } diff --git a/lattices/src/with_top.rs b/lattices/src/with_top.rs index d8c122a1e686..ef12965ee680 100644 --- a/lattices/src/with_top.rs +++ b/lattices/src/with_top.rs @@ -124,7 +124,7 @@ where Inner: IsBot, { fn is_bot(&self) -> bool { - self.0.as_ref().map_or(false, IsBot::is_bot) + self.0.as_ref().is_some_and(IsBot::is_bot) } }