Skip to content

Commit c7e98f8

Browse files
authored
Update to Rust 1.82 (#849)
This makes use of most of the new features enabled by Rust 1.82.
1 parent cdb6502 commit c7e98f8

File tree

21 files changed

+30
-31
lines changed

21 files changed

+30
-31
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ include = [
2424
]
2525
edition = "2021"
2626
resolver = "2"
27-
rust-version = "1.79"
27+
rust-version = "1.82"
2828

2929
[package.metadata.docs.rs]
3030
all-features = true

capi/bind_gen/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ fn main() {
210210
if abi
211211
.as_ref()
212212
.and_then(|a| a.name.as_ref())
213-
.map_or(true, |n| n.value() != "C")
213+
.is_none_or(|n| n.value() != "C")
214214
|| attrs.iter().all(|a| match &a.meta {
215215
Meta::Path(w) => !w.is_ident("no_mangle"),
216216
_ => true,

capi/src/web_command_sink.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ impl CommandSink for WebCommandSink {
267267
handle_action_value(self.set_game_time.as_ref().and_then(|f| {
268268
f.call1(
269269
&self.obj,
270-
&JsValue::from_f64(ptr::addr_of!(time) as usize as f64),
270+
&JsValue::from_f64(&raw const time as usize as f64),
271271
)
272272
.ok()
273273
}))
@@ -296,7 +296,7 @@ impl CommandSink for WebCommandSink {
296296
handle_action_value(self.set_loading_times.as_ref().and_then(|f| {
297297
f.call1(
298298
&self.obj,
299-
&JsValue::from_f64(ptr::addr_of!(time) as usize as f64),
299+
&JsValue::from_f64(&raw const time as usize as f64),
300300
)
301301
.ok()
302302
}))

crates/livesplit-auto-splitting/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
88
description = "livesplit-auto-splitting is a library that provides a runtime for running auto splitters that can control a speedrun timer. These auto splitters are provided as WebAssembly modules."
99
keywords = ["speedrun", "timer", "livesplit", "auto-splitting"]
1010
edition = "2021"
11-
rust-version = "1.79"
11+
rust-version = "1.82"
1212

1313
[dependencies]
1414
anyhow = { version = "1.0.45", default-features = false }

crates/livesplit-auto-splitting/src/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl Process {
111111
pub(super) fn list_pids_by_name<'a>(
112112
name: &'a str,
113113
process_list: &'a mut ProcessList,
114-
) -> impl Iterator<Item = u32> + 'a {
114+
) -> impl Iterator<Item = u32> + use<'a> {
115115
process_list.refresh();
116116
process_list
117117
.processes_by_name(name)

crates/livesplit-auto-splitting/src/runtime/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ impl ProcessList {
146146
}
147147
}
148148

149-
pub fn processes_by_name<'process: 'both, 'both>(
149+
pub fn processes_by_name<'process, 'both>(
150150
&'process self,
151151
name: &'both str,
152-
) -> impl Iterator<Item = &'process sysinfo::Process> + 'both {
152+
) -> impl Iterator<Item = &'process sysinfo::Process> + use<'both, 'process> {
153153
let name = name.as_bytes();
154154

155155
// On Linux the process name is limited to 15 bytes. So we ensure that

src/analysis/pb_chance/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub fn for_timer(timer: &Snapshot<'_>) -> (f64, bool) {
8080
let beat_pb = all_segments
8181
.last()
8282
.and_then(|s| s.personal_best_split_time()[method])
83-
.map_or(true, |pb| current_time < pb);
83+
.is_none_or(|pb| current_time < pb);
8484
if beat_pb {
8585
1.0
8686
} else {

src/analysis/skill_curve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl SkillCurve {
132132
pub fn iter_segment_times_at_percentile(
133133
&self,
134134
percentile: f64,
135-
) -> impl Iterator<Item = TimeSpan> + '_ {
135+
) -> impl Iterator<Item = TimeSpan> + use<'_> {
136136
self.all_weighted_segment_times
137137
.iter()
138138
.map(move |weighted_segment_times| {
@@ -181,7 +181,7 @@ impl SkillCurve {
181181
&self,
182182
percentile: f64,
183183
offset: TimeSpan,
184-
) -> impl Iterator<Item = TimeSpan> + '_ {
184+
) -> impl Iterator<Item = TimeSpan> + use<'_> {
185185
let mut sum = offset;
186186
self.iter_segment_times_at_percentile(percentile)
187187
.map(move |segment_time| {

src/analysis/state_helper.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ pub fn check_best_segment(timer: &Timer, segment_index: usize, method: TimingMet
353353
let delta = previous_segment_delta(timer, segment_index, best_segments::NAME, method);
354354
let current_segment = previous_segment_time(timer, segment_index, method);
355355
let best_segment = timer.run().segment(segment_index).best_segment_time()[method];
356-
best_segment.map_or(true, |b| {
356+
best_segment.is_none_or(|b| {
357357
current_segment.is_some_and(|c| c < b) || delta.is_some_and(|d| d < TimeSpan::zero())
358358
})
359359
}

src/analysis/sum_of_segments/best.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ fn populate_prediction(
1616
predicted_time: Option<TimeSpan>,
1717
) {
1818
if let Some(predicted_time) = predicted_time {
19-
if target_prediction.map_or(true, |p| predicted_time < p.time) {
19+
if target_prediction.is_none_or(|p| predicted_time < p.time) {
2020
*target_prediction = Some(Prediction {
2121
time: predicted_time,
2222
predecessor,

0 commit comments

Comments
 (0)