Skip to content

Commit

Permalink
chore: update pinned nightly to 2025-02-10, cleanups for clippy (#1704)
Browse files Browse the repository at this point in the history
  • Loading branch information
MingweiSamuel authored Feb 11, 2025
1 parent f95252c commit 2fd6aa7
Show file tree
Hide file tree
Showing 18 changed files with 19 additions and 37 deletions.
1 change: 0 additions & 1 deletion datastores/gossip_kv/server/membership.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ pub fn member_name(random_suffix_len: usize) -> &'static MemberId {
let suffix: String = thread_rng()
.sample_iter(&LowercaseAlphanumeric)
.take(4)
.map(char::from)
.collect();
format!("{}-{}", hostname, suffix)
} else {
Expand Down
4 changes: 0 additions & 4 deletions dfir_lang/src/graph/hydroflow_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1056,10 +1056,6 @@ impl DfirGraph {
subgraph_op_iter_code.push(write_iterator);

if include_type_guards {
#[cfg_attr(
not(nightly),
expect(unused_labels, reason = "conditional compilation")
)]
let source_tag = 'a: {
if let Some(tag) = self.operator_tag.get(node_id).cloned() {
break 'a tag;
Expand Down
4 changes: 2 additions & 2 deletions dfir_rs/examples/shopping/lattices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ impl<T: Eq> PartialOrd<Self> for BoundedPrefix<T> {
// ensure each vec is not in internal conflict with its len
assert!(self
.len
.map_or(true, |self_len_some| self.vec.len() <= self_len_some));
.is_none_or(|self_len_some| self.vec.len() <= self_len_some));
assert!(other
.len
.map_or(true, |other_len_some| other.vec.len() <= other_len_some));
.is_none_or(|other_len_some| other.vec.len() <= other_len_some));

// `self` has some field indicating it is greater than `other`.
let mut self_greater = false;
Expand Down
4 changes: 2 additions & 2 deletions dfir_rs/examples/two_pc_hf/coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ pub(crate) async fn run_coordinator(outbound: UdpSink, inbound: UdpStream, opts:
msgs = inbound_chan[0] -> demux(|m:SubordResponse, var_args!(commits, aborts, acks, endeds, errs)| match m.mtype {
MsgType::Commit => commits.give(m),
MsgType::Abort => aborts.give(m),
MsgType::AckP2 {..} => acks.give(m),
MsgType::Ended {..} => endeds.give(m),
MsgType::AckP2 => acks.give(m),
MsgType::Ended => endeds.give(m),
_ => errs.give(m),
});
msgs[errs] -> for_each(|m| println!("Received unexpected message type: {:?}", m));
Expand Down
5 changes: 1 addition & 4 deletions dfir_rs/examples/two_pc_hf/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
pub fn parse_out<T: std::str::FromStr>(line: String) -> Option<T> {
match line.trim().parse::<T>() {
Ok(the_xid) => Some(the_xid),
Err(_) => None,
}
line.trim().parse::<T>().ok()
}

use rand::Rng;
Expand Down
2 changes: 1 addition & 1 deletion dfir_rs/examples/two_pc_hf/subordinate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub(crate) async fn run_subordinate(outbound: UdpSink, inbound: UdpStream, opts:
MsgType::Prepare => prepares.give(m),
MsgType::Abort => p2.give(m),
MsgType::Commit => p2.give(m),
MsgType::End {..} => ends.give(m),
MsgType::End => ends.give(m),
_ => errs.give(m),
});
msgs[errs] -> for_each(|m| println!("Received unexpected message type: {:?}", m));
Expand Down
4 changes: 2 additions & 2 deletions dfir_rs/src/util/monotonic_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ where

/// Inserts the value using the function if new `key` is strictly later than the current key.
pub fn get_mut_with(&mut self, key: K, init: impl FnOnce() -> V) -> &mut V {
if self.key.as_ref().map_or(true, |old_key| old_key < &key) {
if self.key.as_ref().is_none_or(|old_key| old_key < &key) {
self.key = Some(key);
self.val = (init)();
}
Expand Down Expand Up @@ -85,7 +85,7 @@ where
/// Gets a mutable reference to the inner value. If `key` is strictly later than the existing
/// key, the value will be cleared via the [`Clear`] trait.
pub fn get_mut_clear(&mut self, key: K) -> &mut V {
if self.key.as_ref().map_or(true, |old_key| old_key < &key) {
if self.key.as_ref().is_none_or(|old_key| old_key < &key) {
self.key = Some(key);
self.val.clear();
}
Expand Down
2 changes: 1 addition & 1 deletion hydro_test/src/cluster/bench_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pub fn bench_client<'a>(
.all_ticks()
.for_each(q!(move |(latencies, throughput)| {
let mut latencies_mut = latencies.borrow_mut();
if latencies_mut.len() > 0 {
if !latencies_mut.is_empty() {
let middle_idx = latencies_mut.len() / 2;
let (_, median, _) = latencies_mut.select_nth_unstable(middle_idx);
println!("Median latency: {}ms", median.as_micros() as f64 / 1000.0);
Expand Down
2 changes: 1 addition & 1 deletion hydro_test/src/cluster/paxos_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn paxos_bench<'a, Paxos: PaxosLike<'a>>(
num_clients_per_node: usize,
median_latency_window_size: usize, /* How many latencies to keep in the window for calculating the median */
checkpoint_frequency: usize, // How many sequence numbers to commit before checkpointing
f: usize, // Maximum number of faulty nodes. A payload has been processed once f+1 replicas have processed it.
f: usize, /* Maximum number of faulty nodes. A payload has been processed once f+1 replicas have processed it. */
num_replicas: usize,
create_paxos: impl FnOnce(Stream<usize, Cluster<'a, Replica>, Unbounded>) -> Paxos,
) -> (Cluster<'a, Client>, Cluster<'a, Replica>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4572,7 +4572,7 @@ snapshot_kind: text
},
},
ForEach {
f: stageleft :: runtime_support :: fn1_type_hint :: < (std :: rc :: Rc < core :: cell :: RefCell < std :: vec :: Vec < core :: time :: Duration > > > , usize) , () > ({ use crate :: __staged :: cluster :: bench_client :: * ; move | (latencies , throughput) | { let mut latencies_mut = latencies . borrow_mut () ; if latencies_mut . len () > 0 { let middle_idx = latencies_mut . len () / 2 ; let (_ , median , _) = latencies_mut . select_nth_unstable (middle_idx) ; println ! ("Median latency: {}ms" , median . as_micros () as f64 / 1000.0) ; } println ! ("Throughput: {} requests/s" , throughput) ; } }),
f: stageleft :: runtime_support :: fn1_type_hint :: < (std :: rc :: Rc < core :: cell :: RefCell < std :: vec :: Vec < core :: time :: Duration > > > , usize) , () > ({ use crate :: __staged :: cluster :: bench_client :: * ; move | (latencies , throughput) | { let mut latencies_mut = latencies . borrow_mut () ; if ! latencies_mut . is_empty () { let middle_idx = latencies_mut . len () / 2 ; let (_ , median , _) = latencies_mut . select_nth_unstable (middle_idx) ; println ! ("Median latency: {}ms" , median . as_micros () as f64 / 1000.0) ; } println ! ("Throughput: {} requests/s" , throughput) ; } }),
input: Map {
f: stageleft :: runtime_support :: fn1_type_hint :: < ((std :: rc :: Rc < core :: cell :: RefCell < std :: vec :: Vec < core :: time :: Duration > > > , usize) , ()) , (std :: rc :: Rc < core :: cell :: RefCell < std :: vec :: Vec < core :: time :: Duration > > > , usize) > ({ use hydro_lang :: __staged :: singleton :: * ; | (d , _signal) | d }),
input: CrossSingleton {
Expand Down
2 changes: 1 addition & 1 deletion lattices/src/conflict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ where
{
fn merge(&mut self, other: Conflict<O>) -> bool {
if let Some(val_self) = &self.0 {
if other.0.map_or(true, |val_other| val_self != &val_other) {
if other.0.is_none_or(|val_other| val_self != &val_other) {
self.0 = None;
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion lattices/src/with_bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ where
Inner: IsBot,
{
fn is_bot(&self) -> bool {
self.0.as_ref().map_or(true, IsBot::is_bot)
self.0.as_ref().is_none_or(IsBot::is_bot)
}
}

Expand Down
2 changes: 1 addition & 1 deletion lattices/src/with_top.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ where
Inner: IsTop,
{
fn is_top(&self) -> bool {
self.0.as_ref().map_or(true, IsTop::is_top)
self.0.as_ref().is_none_or(IsTop::is_top)
}
}

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2024-09-05" # Make sure to update `template/*/rust-toolchain.toml` as well.
channel = "nightly-2025-02-10" # Make sure to update `template/*/rust-toolchain.toml` as well.
components = ["rustfmt", "clippy"]
targets = ["wasm32-unknown-unknown", "x86_64-unknown-linux-musl"]
2 changes: 1 addition & 1 deletion template/dfir/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "nightly-2024-09-05"
channel = "nightly-2025-02-10"
2 changes: 1 addition & 1 deletion template/hydro/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2024-09-05"
channel = "nightly-2025-02-10"
components = ["rustfmt", "clippy"]
targets = ["x86_64-unknown-linux-musl"]
4 changes: 2 additions & 2 deletions variadics/src/variadic_collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ where
let reserve = if self.is_empty() {
iter.size_hint().0
} else {
(iter.size_hint().0 + 1) / 2
iter.size_hint().0.div_ceil(2)
};
self.table
.reserve(reserve, |item| self.hasher.hash_one(item));
Expand Down Expand Up @@ -427,7 +427,7 @@ where
let reserve = if self.is_empty() {
iter.size_hint().0
} else {
(iter.size_hint().0 + 1) / 2
iter.size_hint().0.div_ceil(2)
};
self.table
.reserve(reserve, |item| self.hasher.hash_one(item));
Expand Down
10 changes: 0 additions & 10 deletions variadics/tests/compile-fail/var_type_spread_badtype.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,3 @@ error[E0277]: the trait bound `f64: VariadicExt` is not satisfied
= help: the following other types implement trait `VariadicExt`:
()
(Item, Rest)

error[E0277]: the trait bound `f64: VariadicExt` is not satisfied
--> tests/compile-fail/var_type_spread_badtype.rs:5:23
|
5 | fn check(_: List) {}
| ^^ the trait `VariadicExt` is not implemented for `f64`
|
= help: the following other types implement trait `VariadicExt`:
()
(Item, Rest)

0 comments on commit 2fd6aa7

Please sign in to comment.