Skip to content

Commit adb5275

Browse files
committed
Bump clippy to 1.84.0, fix respective lints
1 parent 61bd2ae commit adb5275

24 files changed

Lines changed: 35 additions & 38 deletions

File tree

clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
msrv = "1.80.0"
1+
msrv = "1.84.0"

crates/buffered_watch/src/receiver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl<T> Receiver<T> {
2121
}
2222

2323
/// Borrows the latest value
24-
pub fn borrow(&mut self) -> ReceiverGuard<T> {
24+
pub fn borrow(&'_ mut self) -> ReceiverGuard<'_, T> {
2525
let shared = self.shared.read();
2626
let index = {
2727
let states = &mut *shared.states.lock();
@@ -38,7 +38,7 @@ impl<T> Receiver<T> {
3838
}
3939

4040
/// Borrows the latest value and marks the buffer as seen
41-
pub fn borrow_and_mark_as_seen(&mut self) -> ReceiverGuard<T> {
41+
pub fn borrow_and_mark_as_seen(&'_ mut self) -> ReceiverGuard<'_, T> {
4242
let shared = self.shared.read();
4343
let index = {
4444
let states = &mut *shared.states.lock();

crates/buffered_watch/src/sender.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ unsafe impl<T> Send for Sender<T> where T: Send + Sync {}
2121

2222
impl<T> Sender<T> {
2323
/// Borrows the latest value
24-
pub fn borrow(&mut self) -> ReceiverGuard<T> {
24+
pub fn borrow(&'_ mut self) -> ReceiverGuard<'_, T> {
2525
let shared = self.shared.read();
2626
let index = {
2727
let states = &mut *shared.states.lock();
@@ -38,7 +38,7 @@ impl<T> Sender<T> {
3838
}
3939

4040
/// Borrows a buffer to write to
41-
pub fn borrow_mut(&mut self) -> SenderGuard<T> {
41+
pub fn borrow_mut(&'_ mut self) -> SenderGuard<'_, T> {
4242
let shared = self.shared.read();
4343
let index = {
4444
let states = &mut *shared.states.lock();

crates/code_generation/src/execution.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ fn generate_cycler_constructors(cyclers: &Cyclers, mode: CyclerMode) -> TokenStr
516516
} else {
517517
Default::default()
518518
};
519-
let error_message = format!("failed to create cycler `{}`", instance);
519+
let error_message = format!("failed to create cycler `{instance}`");
520520

521521
quote! {
522522
#[allow(unused)]
@@ -567,7 +567,7 @@ fn generate_cycler_starts(cyclers: &Cyclers) -> TokenStream {
567567
format_ident!("{}_cycler", instance.to_case(Case::Snake));
568568
let cycler_handle_identifier =
569569
format_ident!("{}_handle", instance.to_case(Case::Snake));
570-
let error_message = format!("failed to start cycler `{}`", instance);
570+
let error_message = format!("failed to start cycler `{instance}`");
571571
quote! {
572572
let #cycler_handle_identifier = #cycler_variable_identifier
573573
.start(keep_running.clone())
@@ -644,7 +644,7 @@ fn generate_cycler_replays(cyclers: &Cyclers) -> TokenStream {
644644
.map(|(_cycler, instance)| {
645645
let cycler_variable_identifier =
646646
format_ident!("{}_cycler", instance.to_case(Case::Snake));
647-
let error_message = format!("failed to replay {} cycle", instance);
647+
let error_message = format!("failed to replay {instance} cycle");
648648
quote! {
649649
#instance => self.#cycler_variable_identifier.cycle(timestamp, data).wrap_err(#error_message),
650650
}

crates/control/src/free_kick_signal_filter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ impl FreeKickSignalFilter {
172172
time: context.cycle_time.start_time,
173173
detected_kicking_team: own_detected_kicking_team,
174174
});
175-
if self.last_time_message_sent.as_ref().map_or(true, |time| {
175+
if self.last_time_message_sent.as_ref().is_none_or(|time| {
176176
now.duration_since(*time).expect("Time ran backwards") >= *context.message_interval
177177
}) && context.remaining_amount_of_messages.is_some_and(
178178
|remaining_amount_of_messages| {

crates/control/src/localization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ impl Localization {
249249
self.hypotheses
250250
.clone_from(&self.hypotheses_when_entered_playing);
251251
}
252-
} else if self.time_when_penalized_clicked.map_or(true, |time| {
252+
} else if self.time_when_penalized_clicked.is_none_or(|time| {
253253
context
254254
.cycle_time
255255
.start_time

crates/control/src/ready_signal_detection_filter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl ReadySignalDetectionFilter {
155155
let now = context.cycle_time.start_time;
156156
self.detection_times[*context.player_number] = Some(now);
157157

158-
if self.last_time_message_sent.as_ref().map_or(true, |time| {
158+
if self.last_time_message_sent.as_ref().is_none_or(|time| {
159159
now.duration_since(*time).expect("Time ran backwards") >= *context.message_interval
160160
}) && context.remaining_amount_of_messages.is_some_and(
161161
|remaining_amount_of_messages| {

crates/framework/src/perception_databases.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ where
3838
self.first_timestamp_of_temporary_databases
3939
}
4040

41-
pub fn persistent(&self) -> Range<SystemTime, Databases> {
41+
pub fn persistent(&'_ self) -> Range<'_, SystemTime, Databases> {
4242
if let Some(first_timestamp_of_temporary_databases) =
4343
self.first_timestamp_of_temporary_databases
4444
{
@@ -49,7 +49,7 @@ where
4949
}
5050
}
5151

52-
pub fn temporary(&self) -> Range<SystemTime, Databases> {
52+
pub fn temporary(&'_ self) -> Range<'_, SystemTime, Databases> {
5353
if let Some(first_timestamp_of_temporary_databases) =
5454
self.first_timestamp_of_temporary_databases
5555
{

crates/hulk_imagine/src/write_to_mcap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ where
6161

6262
outputs.into_iter().try_for_each(|(topic, data)| {
6363
mcap_converter.add_to_mcap(
64-
format!("{}.{}", cycler_name, topic),
64+
format!("{cycler_name}.{topic}"),
6565
&data,
6666
index as u32,
6767
timing.timestamp,

crates/hulk_replayer/src/ticks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl<'state> Ticks<'state> {
181181
absolute_time_to_time_string(current.map_to_absolute_time(self.frame_range));
182182
let galley = painter.layout_no_wrap(text.clone(), font.clone(), color_strong);
183183
let text_position = pos2(x.inner() - galley.rect.width() / 2.0, clip_rect.top());
184-
if position_text_rect.map_or(true, |position_text_rect| {
184+
if position_text_rect.is_none_or(|position_text_rect| {
185185
!galley
186186
.rect
187187
.translate(text_position.to_vec2())

0 commit comments

Comments
 (0)