Skip to content

Commit

Permalink
elide unneccessary lifetimes (#1484)
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidma authored Nov 2, 2024
1 parent 52b5e15 commit 25a4353
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 22 deletions.
6 changes: 3 additions & 3 deletions crates/buffered_watch/src/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,21 @@ pub struct SenderGuard<'lock, T> {
buffer: &'lock mut T,
}

impl<'lock, T> Deref for SenderGuard<'lock, T> {
impl<T> Deref for SenderGuard<'_, T> {
type Target = T;

fn deref(&self) -> &Self::Target {
self.buffer.deref()
}
}

impl<'lock, T> DerefMut for SenderGuard<'lock, T> {
impl<T> DerefMut for SenderGuard<'_, T> {
fn deref_mut(&mut self) -> &mut T {
self.buffer.deref_mut()
}
}

impl<'lock, T> Drop for SenderGuard<'lock, T> {
impl<T> Drop for SenderGuard<'_, T> {
fn drop(&mut self) {
{
let mut states = self.shared.states.lock();
Expand Down
12 changes: 6 additions & 6 deletions crates/hulk_nao/src/double_buffered_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,12 @@ mod tests {
struct Reader<'buffer> {
reversed_items: Vec<Option<Item<'buffer>>>,
}
impl<'buffer> AsRawFd for Reader<'buffer> {
impl AsRawFd for Reader<'_> {
fn as_raw_fd(&self) -> RawFd {
FIXED_FILE_DESCRIPTOR
}
}
impl<'buffer> Read for Reader<'buffer> {
impl Read for Reader<'_> {
fn read(&mut self, buffer: &mut [u8]) -> io::Result<usize> {
match self.reversed_items.pop() {
Some(Some(item)) => {
Expand Down Expand Up @@ -344,12 +344,12 @@ mod tests {
struct Reader<'buffer> {
reversed_items: Vec<Option<Item<'buffer>>>,
}
impl<'buffer> AsRawFd for Reader<'buffer> {
impl AsRawFd for Reader<'_> {
fn as_raw_fd(&self) -> RawFd {
FIXED_FILE_DESCRIPTOR
}
}
impl<'buffer> Read for Reader<'buffer> {
impl Read for Reader<'_> {
fn read(&mut self, buffer: &mut [u8]) -> io::Result<usize> {
match self.reversed_items.pop() {
Some(Some(item)) => {
Expand Down Expand Up @@ -407,12 +407,12 @@ mod tests {
struct Reader<'buffer> {
reversed_items: Vec<Option<Item<'buffer>>>,
}
impl<'buffer> AsRawFd for Reader<'buffer> {
impl AsRawFd for Reader<'_> {
fn as_raw_fd(&self) -> RawFd {
FIXED_FILE_DESCRIPTOR
}
}
impl<'buffer> Read for Reader<'buffer> {
impl Read for Reader<'_> {
fn read(&mut self, buffer: &mut [u8]) -> io::Result<usize> {
match self.reversed_items.pop() {
Some(Some(item)) => {
Expand Down
2 changes: 1 addition & 1 deletion crates/hulk_replayer/src/frames.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl<'state> Frames<'state> {
}
}

impl<'state> Widget for Frames<'state> {
impl Widget for Frames<'_> {
fn ui(mut self, ui: &mut Ui) -> Response {
let (mut response, painter) =
ui.allocate_painter(ui.available_size(), Sense::click_and_drag());
Expand Down
2 changes: 1 addition & 1 deletion crates/hulk_replayer/src/labels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl<'state> Labels<'state> {
}
}

impl<'state> Widget for Labels<'state> {
impl Widget for Labels<'_> {
fn ui(self, ui: &mut Ui) -> Response {
let spacing = ui.spacing().item_spacing.y;
let total_spacing = spacing * (self.labels.len() - 1) as f32;
Expand Down
2 changes: 1 addition & 1 deletion crates/hulk_replayer/src/ticks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl<'state> Ticks<'state> {
}
}

impl<'state> Widget for Ticks<'state> {
impl Widget for Ticks<'_> {
fn ui(self, ui: &mut Ui) -> Response {
let mut size = ui.available_size();
size.y = ticks_height(ui);
Expand Down
2 changes: 1 addition & 1 deletion crates/hulk_replayer/src/timeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl<'state> Timeline<'state> {
}
}

impl<'state> Widget for Timeline<'state> {
impl Widget for Timeline<'_> {
fn ui(self, ui: &mut Ui) -> Response {
let original_item_spacing = ui.spacing().item_spacing;
ui.spacing_mut().item_spacing = Vec2::ZERO;
Expand Down
4 changes: 2 additions & 2 deletions crates/types/src/players.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl<'a, T> Iterator for PlayersIterator<'a, T> {
}
}

impl<'a, T> DoubleEndedIterator for PlayersIterator<'a, T> {
impl<T> DoubleEndedIterator for PlayersIterator<'_, T> {
fn next_back(&mut self) -> Option<Self::Item> {
let result = self.next_back.map(|number| (number, &self.data[number]));
if self.next_forward == self.next_back {
Expand All @@ -165,7 +165,7 @@ impl<'a, T> DoubleEndedIterator for PlayersIterator<'a, T> {
}
}

impl<'a, T> ExactSizeIterator for PlayersIterator<'a, T> {
impl<T> ExactSizeIterator for PlayersIterator<'_, T> {
// The default implementation only requires `Iterator::size_hint()` to be exact
}

Expand Down
1 change: 0 additions & 1 deletion crates/walking_engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ mod stiffness;
/// The algorithm to compute the feet trajectories is loosely based on the work of Bernhard Hengst
/// at the team rUNSWift. An explanation of this algorithm can be found in the team's research
/// report from 2014 (<http://cgi.cse.unsw.edu.au/~robocup/2014ChampionTeamPaperReports/20140930-Bernhard.Hengst-Walk2014Report.pdf>).
pub struct Context<'a> {
pub parameters: &'a Parameters,
pub kick_steps: &'a KickSteps,
Expand Down
2 changes: 1 addition & 1 deletion tools/annotato/src/widgets/bounding_box_annotator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl<'a> BoundingBoxAnnotator<'a> {
}
}

impl<'a> Widget for BoundingBoxAnnotator<'a> {
impl Widget for BoundingBoxAnnotator<'_> {
fn ui(mut self, ui: &mut Ui) -> Response {
let response = Plot::new(self.id)
.data_aspect(1.)
Expand Down
2 changes: 1 addition & 1 deletion tools/annotato/src/widgets/class_selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl<'a> ClassSelector<'a> {
}
}

impl<'a> Widget for ClassSelector<'a> {
impl Widget for ClassSelector<'_> {
fn ui(self, ui: &mut Ui) -> Response {
if let Some(class) = ui.input(|i| i.keys_down.iter().find_map(|key| Class::from_key(*key)))
{
Expand Down
2 changes: 1 addition & 1 deletion tools/annotato/src/widgets/image_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl<'a> ImageList<'a> {
}
}

impl<'a> Widget for ImageList<'a> {
impl Widget for ImageList<'_> {
fn ui(self, ui: &mut eframe::egui::Ui) -> eframe::egui::Response {
ui.vertical(|ui| {
ui.label("Image List");
Expand Down
2 changes: 1 addition & 1 deletion tools/annotato/src/widgets/path_row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl<'a> Row<'a> {
}
}

impl<'a> Widget for Row<'a> {
impl Widget for Row<'_> {
fn ui(self, ui: &mut Ui) -> Response {
let filename = self.paths.image_path.display().to_string();
let is_labelled = self.paths.label_present;
Expand Down
2 changes: 1 addition & 1 deletion tools/twix/src/configuration/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl<'de> Deserialize<'de> for KeybindTrigger {
{
struct Visitor;

impl<'de> de::Visitor<'de> for Visitor {
impl de::Visitor<'_> for Visitor {
type Value = KeybindTrigger;

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion tools/twix/src/panels/image/cycler_selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl<'a> VisionCyclerSelector<'a> {
}
}

impl<'a> Widget for &mut VisionCyclerSelector<'a> {
impl Widget for &mut VisionCyclerSelector<'_> {
fn ui(self, ui: &mut Ui) -> Response {
let mut selection_changed = false;
let mut combo_box = ComboBox::from_label("Cycler")
Expand Down

0 comments on commit 25a4353

Please sign in to comment.