Skip to content

Commit 53c6f8a

Browse files
authored
Bump to Rust 1.81.0 (#513)
* Update to Rust 1.81 * Fix clippy complaints * Make sorting stable and update trycmd tests
1 parent ac2272f commit 53c6f8a

40 files changed

+338
-342
lines changed

.cargo/config.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[alias]
2+
xtask = "run --package xtask --"
3+
4+
[profile.release]
5+
overflow-checks = true

cmd/counters/src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -512,14 +512,12 @@ fn counters_dump_csv(
512512
) {
513513
// Sort the counters.
514514
match opts.sort {
515-
Some(Order::Value) => counters.sort_unstable_by(
515+
Some(Order::Value) => counters.sort_by(
516516
&mut |_, a: &CounterVariant, _, b: &CounterVariant| {
517517
a.total().cmp(&b.total()).reverse()
518518
},
519519
),
520-
Some(Order::Alpha) => {
521-
counters.sort_unstable_by(&mut |a, _, b, _| a.cmp(b))
522-
}
520+
Some(Order::Alpha) => counters.sort_by(&mut |a, _, b, _| a.cmp(b)),
523521
_ => {}
524522
}
525523

@@ -574,13 +572,13 @@ fn counter_dump(counters: &mut Counters, opts: &Options, pad: &str) {
574572
// Therefore, sort by value by default, so the highest-valued counters
575573
// are shown first.
576574
Options { sort: Some(Order::Value), .. }
577-
| Options { sort: None, full: false, .. } => counters.sort_unstable_by(
575+
| Options { sort: None, full: false, .. } => counters.sort_by(
578576
&mut |_, a: &CounterVariant, _, b: &CounterVariant| {
579577
a.total().cmp(&b.total()).reverse()
580578
},
581579
),
582580
Options { sort: Some(Order::Alpha), .. } => {
583-
counters.sort_unstable_by(&mut |a, _, b, _| a.cmp(b))
581+
counters.sort_by(&mut |a, _, b, _| a.cmp(b))
584582
}
585583
}
586584

cmd/dashboard/src/lib.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl StatefulList {
7979

8080
fn previous(&mut self) {
8181
self.state.select(match self.state.selected() {
82-
Some(ndx) if ndx == 0 => Some(self.n - 1),
82+
Some(0) => Some(self.n - 1),
8383
Some(ndx) => Some(ndx - 1),
8484
None => Some(0),
8585
});
@@ -114,8 +114,6 @@ trait Attributes {
114114
fn decrease(&mut self, _ndx: usize) -> Option<u8> {
115115
None
116116
}
117-
118-
fn clear(&mut self) {}
119117
}
120118

121119
struct TempGraph;
@@ -185,12 +183,6 @@ impl Attributes for FanGraph {
185183
self.0[ndx] = if nval >= 0 { nval as u8 } else { 0 };
186184
Some(self.0[ndx])
187185
}
188-
189-
fn clear(&mut self) {
190-
for val in self.0.iter_mut() {
191-
*val = 0;
192-
}
193-
}
194186
}
195187

196188
struct CurrentGraph;

cmd/monorail/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ fn monorail_status(
756756
Value::Enum(m) => {
757757
let mode = m.disc().to_uppercase();
758758
let speed = m.contents().and_then(|speed| match speed {
759-
Value::Tuple(t) => t.get(0).map(|t| match t {
759+
Value::Tuple(t) => t.first().map(|t| match t {
760760
Value::Enum(t) => t.disc().replace("Speed", ""),
761761
v => panic!("Expected enum, got {:?}", v),
762762
}),

cmd/net/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
//! - Sidecar
1515
//! - PSC
1616
//! - `gimletlet-mgmt`
17+
//!
1718
//! These PCAs have the KSZ8463 switch + VSC85x2 PHY which is our standard
1819
//! management network interface.
1920
//!

cmd/probe/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ fn probecmd(context: &mut ExecutionContext) -> Result<()> {
270270
Ok("progressing")
271271
}
272272
})
273-
.map_or_else(|_| "unable to step", |s| s)
273+
.unwrap_or("unable to step")
274274
.to_string();
275275
core.run()?;
276276
rval

cmd/ringbuf/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ fn ringbuf_dump(
161161
// system, and can't easily be compared. Therefore, sort them by the
162162
// value of the counter, so the most frequently recorded variants
163163
// are displayed first.
164-
counters.sort_unstable_by(
164+
counters.sort_by(
165165
&mut |_, a: &CounterVariant, _, b: &CounterVariant| {
166166
a.total().cmp(&b.total()).reverse()
167167
},

cmd/rpc/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ fn rpc_listen_one(
157157
interface: u32,
158158
port: u32,
159159
) -> Result<BTreeSet<Target>> {
160-
let socket = match UdpSocket::bind(&format!("[::]:{port}")) {
160+
let socket = match UdpSocket::bind(format!("[::]:{port}")) {
161161
Ok(s) => s,
162162
Err(e) => {
163163
if e.kind() == std::io::ErrorKind::PermissionDenied {

humility-core/src/core.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ impl GDBCore {
10401040
//
10411041
let val = u64::from_le_bytes(buf[..].try_into().unwrap());
10421042

1043-
if val > std::u32::MAX.into() {
1043+
if val > u32::MAX.into() {
10441044
Err(anyhow!("bad 64-bit return on cmd {}: {}", cmd, rstr))
10451045
} else {
10461046
Ok(val as u32)

humility-core/src/hubris.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ impl HubrisArchive {
799799
// is less than our base.
800800
//
801801
for (&(addr, _depth), (len, goff, origin)) in
802-
self.inlined.range(..=(pc, std::isize::MAX)).rev()
802+
self.inlined.range(..=(pc, isize::MAX)).rev()
803803
{
804804
if addr + len < base {
805805
break;
@@ -3046,7 +3046,7 @@ impl HubrisArchive {
30463046
return Ok(v.size);
30473047
}
30483048

3049-
if self.ptrtypes.get(&goff).is_some() {
3049+
if self.ptrtypes.contains_key(&goff) {
30503050
return Ok(4);
30513051
}
30523052

@@ -3970,7 +3970,7 @@ impl HubrisObjectLoader {
39703970
// If this is a zero-sized symbol or not against an allocated
39713971
// section (e.g., .idolatry), we don't want to keep track of it.
39723972
//
3973-
if sym.st_size == 0 || allocs.get(&sym.st_shndx).is_none() {
3973+
if sym.st_size == 0 || !allocs.contains(&sym.st_shndx) {
39743974
continue;
39753975
}
39763976

0 commit comments

Comments
 (0)