diff --git a/Cargo.toml b/Cargo.toml index d9a07b2e..e6d46a02 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ include = [ ] edition = "2021" resolver = "2" -rust-version = "1.79" +rust-version = "1.82" [package.metadata.docs.rs] all-features = true diff --git a/capi/bind_gen/src/main.rs b/capi/bind_gen/src/main.rs index ca782651..27b4be0d 100644 --- a/capi/bind_gen/src/main.rs +++ b/capi/bind_gen/src/main.rs @@ -210,7 +210,7 @@ fn main() { if abi .as_ref() .and_then(|a| a.name.as_ref()) - .map_or(true, |n| n.value() != "C") + .is_none_or(|n| n.value() != "C") || attrs.iter().all(|a| match &a.meta { Meta::Path(w) => !w.is_ident("no_mangle"), _ => true, diff --git a/capi/src/web_command_sink.rs b/capi/src/web_command_sink.rs index 2dc3a28e..e48afc8e 100644 --- a/capi/src/web_command_sink.rs +++ b/capi/src/web_command_sink.rs @@ -267,7 +267,7 @@ impl CommandSink for WebCommandSink { handle_action_value(self.set_game_time.as_ref().and_then(|f| { f.call1( &self.obj, - &JsValue::from_f64(ptr::addr_of!(time) as usize as f64), + &JsValue::from_f64(&raw const time as usize as f64), ) .ok() })) @@ -296,7 +296,7 @@ impl CommandSink for WebCommandSink { handle_action_value(self.set_loading_times.as_ref().and_then(|f| { f.call1( &self.obj, - &JsValue::from_f64(ptr::addr_of!(time) as usize as f64), + &JsValue::from_f64(&raw const time as usize as f64), ) .ok() })) diff --git a/crates/livesplit-auto-splitting/Cargo.toml b/crates/livesplit-auto-splitting/Cargo.toml index 1a191f04..a8400fa0 100644 --- a/crates/livesplit-auto-splitting/Cargo.toml +++ b/crates/livesplit-auto-splitting/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" 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." keywords = ["speedrun", "timer", "livesplit", "auto-splitting"] edition = "2021" -rust-version = "1.79" +rust-version = "1.82" [dependencies] anyhow = { version = "1.0.45", default-features = false } diff --git a/crates/livesplit-auto-splitting/src/process.rs b/crates/livesplit-auto-splitting/src/process.rs index 44261f31..7f862f2f 100644 --- a/crates/livesplit-auto-splitting/src/process.rs +++ b/crates/livesplit-auto-splitting/src/process.rs @@ -111,7 +111,7 @@ impl Process { pub(super) fn list_pids_by_name<'a>( name: &'a str, process_list: &'a mut ProcessList, - ) -> impl Iterator + 'a { + ) -> impl Iterator + use<'a> { process_list.refresh(); process_list .processes_by_name(name) diff --git a/crates/livesplit-auto-splitting/src/runtime/mod.rs b/crates/livesplit-auto-splitting/src/runtime/mod.rs index cb1275a7..f9fe891b 100644 --- a/crates/livesplit-auto-splitting/src/runtime/mod.rs +++ b/crates/livesplit-auto-splitting/src/runtime/mod.rs @@ -146,10 +146,10 @@ impl ProcessList { } } - pub fn processes_by_name<'process: 'both, 'both>( + pub fn processes_by_name<'process, 'both>( &'process self, name: &'both str, - ) -> impl Iterator + 'both { + ) -> impl Iterator + use<'both, 'process> { let name = name.as_bytes(); // On Linux the process name is limited to 15 bytes. So we ensure that diff --git a/src/analysis/pb_chance/mod.rs b/src/analysis/pb_chance/mod.rs index b5c6e3c4..decc37c6 100644 --- a/src/analysis/pb_chance/mod.rs +++ b/src/analysis/pb_chance/mod.rs @@ -80,7 +80,7 @@ pub fn for_timer(timer: &Snapshot<'_>) -> (f64, bool) { let beat_pb = all_segments .last() .and_then(|s| s.personal_best_split_time()[method]) - .map_or(true, |pb| current_time < pb); + .is_none_or(|pb| current_time < pb); if beat_pb { 1.0 } else { diff --git a/src/analysis/skill_curve.rs b/src/analysis/skill_curve.rs index 73d51c36..34b4172b 100644 --- a/src/analysis/skill_curve.rs +++ b/src/analysis/skill_curve.rs @@ -132,7 +132,7 @@ impl SkillCurve { pub fn iter_segment_times_at_percentile( &self, percentile: f64, - ) -> impl Iterator + '_ { + ) -> impl Iterator + use<'_> { self.all_weighted_segment_times .iter() .map(move |weighted_segment_times| { @@ -181,7 +181,7 @@ impl SkillCurve { &self, percentile: f64, offset: TimeSpan, - ) -> impl Iterator + '_ { + ) -> impl Iterator + use<'_> { let mut sum = offset; self.iter_segment_times_at_percentile(percentile) .map(move |segment_time| { diff --git a/src/analysis/state_helper.rs b/src/analysis/state_helper.rs index b29c0617..5c2f2409 100644 --- a/src/analysis/state_helper.rs +++ b/src/analysis/state_helper.rs @@ -353,7 +353,7 @@ pub fn check_best_segment(timer: &Timer, segment_index: usize, method: TimingMet let delta = previous_segment_delta(timer, segment_index, best_segments::NAME, method); let current_segment = previous_segment_time(timer, segment_index, method); let best_segment = timer.run().segment(segment_index).best_segment_time()[method]; - best_segment.map_or(true, |b| { + best_segment.is_none_or(|b| { current_segment.is_some_and(|c| c < b) || delta.is_some_and(|d| d < TimeSpan::zero()) }) } diff --git a/src/analysis/sum_of_segments/best.rs b/src/analysis/sum_of_segments/best.rs index b175802f..c9a230c0 100644 --- a/src/analysis/sum_of_segments/best.rs +++ b/src/analysis/sum_of_segments/best.rs @@ -16,7 +16,7 @@ fn populate_prediction( predicted_time: Option, ) { if let Some(predicted_time) = predicted_time { - if target_prediction.map_or(true, |p| predicted_time < p.time) { + if target_prediction.is_none_or(|p| predicted_time < p.time) { *target_prediction = Some(Prediction { time: predicted_time, predecessor, diff --git a/src/analysis/sum_of_segments/worst.rs b/src/analysis/sum_of_segments/worst.rs index d2b5e184..56c1fca4 100644 --- a/src/analysis/sum_of_segments/worst.rs +++ b/src/analysis/sum_of_segments/worst.rs @@ -13,7 +13,7 @@ fn populate_prediction( predicted_time: Option, ) { if let Some(predicted_time) = predicted_time { - if target_prediction.map_or(true, |p| predicted_time > p.time) { + if target_prediction.is_none_or(|p| predicted_time > p.time) { *target_prediction = Some(Prediction { time: predicted_time, predecessor, diff --git a/src/comparison/best_split_times.rs b/src/comparison/best_split_times.rs index f44330fc..1acbff1b 100644 --- a/src/comparison/best_split_times.rs +++ b/src/comparison/best_split_times.rs @@ -30,7 +30,7 @@ fn generate(segments: &mut [Segment], attempts: &[Attempt], method: TimingMethod total_time += time; let comp = &mut segment.comparison_mut(NAME)[method]; - if comp.map_or(true, |c| total_time < c) { + if comp.is_none_or(|c| total_time < c) { *comp = Some(total_time); } } diff --git a/src/component/timer.rs b/src/component/timer.rs index 45ce814f..064db301 100644 --- a/src/component/timer.rs +++ b/src/component/timer.rs @@ -252,7 +252,7 @@ impl Component { .unwrap() .comparison(current_comparison)[method]; - if pb_time.map_or(true, |t| time < t) { + if pb_time.is_none_or(|t| time < t) { SemanticColor::PersonalBest } else { SemanticColor::BehindLosingTime diff --git a/src/component/title/mod.rs b/src/component/title/mod.rs index f3970315..221f350b 100644 --- a/src/component/title/mod.rs +++ b/src/component/title/mod.rs @@ -293,14 +293,14 @@ impl Component { } state.line2.clear(); } else { - if state.line1.last().map_or(true, |g| game_name != &**g) { + if state.line1.last().is_none_or(|g| game_name != &**g) { state.line1.clear(); state.line1.extend(abbreviate_title(game_name)); } if state .line2 .last() - .map_or(true, |c| full_category_name != &**c) + .is_none_or(|c| full_category_name != &**c) { state.line2.clear(); state.line2.extend(abbreviate_category(full_category_name)); @@ -308,7 +308,7 @@ impl Component { } } (true, false) => { - if state.line1.last().map_or(true, |g| game_name != &**g) { + if state.line1.last().is_none_or(|g| game_name != &**g) { state.line1.clear(); state.line1.extend(abbreviate_title(game_name)); } @@ -318,7 +318,7 @@ impl Component { if state .line1 .last() - .map_or(true, |c| full_category_name != &**c) + .is_none_or(|c| full_category_name != &**c) { state.line1.clear(); state.line1.extend(abbreviate_category(full_category_name)); diff --git a/src/rendering/default_text_engine/color_font/mod.rs b/src/rendering/default_text_engine/color_font/mod.rs index 47a186fb..0dc94c47 100644 --- a/src/rendering/default_text_engine/color_font/mod.rs +++ b/src/rendering/default_text_engine/color_font/mod.rs @@ -26,7 +26,7 @@ impl<'f> ColorTables<'f> { &self, palette: usize, glyph: u16, - ) -> Option)> + '_> { + ) -> Option)> + use<'_>> { let layers = colr::look_up(self.colr, glyph)?; Some(layers.iter().map(move |layer| { let entry_idx = layer.palette_entry_idx(); diff --git a/src/run/comparisons.rs b/src/run/comparisons.rs index c8362767..cde4c4e3 100644 --- a/src/run/comparisons.rs +++ b/src/run/comparisons.rs @@ -69,14 +69,14 @@ impl Comparisons { } /// Iterates over all the comparisons and their times. - pub fn iter(&self) -> impl Iterator, Time)> + '_ { + pub fn iter(&self) -> impl Iterator, Time)> + use<'_> { self.0.iter() } /// Mutably iterates over all the comparisons and their times. Be careful /// when modifying the comparison name. Having duplicates will likely cause /// problems. - pub fn iter_mut(&mut self) -> impl Iterator, Time)> + '_ { + pub fn iter_mut(&mut self) -> impl Iterator, Time)> + use<'_> { self.0.iter_mut() } } diff --git a/src/run/editor/cleaning.rs b/src/run/editor/cleaning.rs index 4fc712b8..a282b4bf 100644 --- a/src/run/editor/cleaning.rs +++ b/src/run/editor/cleaning.rs @@ -241,7 +241,7 @@ fn check_prediction<'a>( method: TimingMethod, ) -> Option> { if let Some(predicted_time) = predicted_time { - if predictions[ending_index + 1].map_or(true, |p| predicted_time < p.time) { + if predictions[ending_index + 1].is_none_or(|p| predicted_time < p.time) { if let Some(segment_history_element) = run.segment(ending_index).segment_history().get(run_index) { diff --git a/src/run/mod.rs b/src/run/mod.rs index 8d325ea2..6f24150c 100644 --- a/src/run/mod.rs +++ b/src/run/mod.rs @@ -598,8 +598,7 @@ impl Run { // Fix Best Segment time if the PB segment is faster if comparison == personal_best::NAME { let current_segment = time - previous_time; - if segment.best_segment_time()[method].map_or(true, |t| t > current_segment) - { + if segment.best_segment_time()[method].is_none_or(|t| t > current_segment) { segment.best_segment_time_mut()[method] = Some(current_segment); } } diff --git a/src/timing/timer/active_attempt.rs b/src/timing/timer/active_attempt.rs index 7909fc95..6177cde2 100644 --- a/src/timing/timer/active_attempt.rs +++ b/src/timing/timer/active_attempt.rs @@ -207,7 +207,7 @@ fn update_best_segments(run: &mut Run) { if split .best_segment_time() .real_time - .map_or(true, |b| current_segment.is_some_and(|c| c < b)) + .is_none_or(|b| current_segment.is_some_and(|c| c < b)) { new_best_segment.real_time = current_segment; } @@ -219,7 +219,7 @@ fn update_best_segments(run: &mut Run) { if split .best_segment_time() .game_time - .map_or(true, |b| current_segment.is_some_and(|c| c < b)) + .is_none_or(|b| current_segment.is_some_and(|c| c < b)) { new_best_segment.game_time = current_segment; } @@ -236,7 +236,7 @@ fn update_pb_splits(run: &mut Run, method: TimingMethod) { last_segment.personal_best_split_time()[method], ) }; - if split_time.is_some_and(|s| pb_split_time.map_or(true, |pb| s < pb)) { + if split_time.is_some_and(|s| pb_split_time.is_none_or(|pb| s < pb)) { super::set_run_as_pb(run); } } diff --git a/src/timing/timer/mod.rs b/src/timing/timer/mod.rs index 3ae72cf8..012d8e7b 100644 --- a/src/timing/timer/mod.rs +++ b/src/timing/timer/mod.rs @@ -405,7 +405,7 @@ impl Timer { if let Some(final_time) = last_segment.split_time()[timing_method] { if last_segment.personal_best_split_time()[timing_method] - .map_or(true, |pb| final_time < pb) + .is_none_or(|pb| final_time < pb) { return true; } diff --git a/src/util/xml/mod.rs b/src/util/xml/mod.rs index 098b8797..9a34dbca 100644 --- a/src/util/xml/mod.rs +++ b/src/util/xml/mod.rs @@ -57,7 +57,7 @@ impl Debug for TagName<'_> { pub struct Attributes<'a>(&'a str); impl<'a> Attributes<'a> { - pub fn iter(self) -> impl Iterator)> + 'a { + pub fn iter(self) -> impl Iterator)> + use<'a> { let mut rem = self.0; iter::from_fn(move || { rem = trim_start(rem);