From 53fa60755f51d122113ba0ee8b50235535fee840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristram=20Gr=C3=A4bener?= Date: Sun, 12 Jan 2025 16:04:55 +0100 Subject: [PATCH] editoast: fix clippy lints in nightly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tristram Gräbener --- editoast/editoast_osrdyne_client/src/lib.rs | 4 ++-- .../src/train_schedule/train_schedule_base.rs | 2 +- editoast/src/models/prelude/update.rs | 2 +- editoast/src/views/infra/edition.rs | 4 ++-- editoast/src/views/infra/lines.rs | 2 +- editoast/src/views/infra/pathfinding.rs | 3 +-- editoast/src/views/train_schedule/projection.rs | 4 ++-- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/editoast/editoast_osrdyne_client/src/lib.rs b/editoast/editoast_osrdyne_client/src/lib.rs index 4d97057f215..555d3ce9219 100644 --- a/editoast/editoast_osrdyne_client/src/lib.rs +++ b/editoast/editoast_osrdyne_client/src/lib.rs @@ -95,7 +95,7 @@ impl OsrdyneClient { Ok(res) } - pub async fn get_workers_statuses<'a, T>( + pub async fn get_workers_statuses( &self, keys: &[T], ) -> Result, Error> @@ -127,7 +127,7 @@ struct OsrdyneWorkerMetadata { } impl HTTPClient { - pub async fn get_workers_statuses<'a, T>( + pub async fn get_workers_statuses( &self, keys: &[T], ) -> Result, Error> diff --git a/editoast/editoast_schemas/src/train_schedule/train_schedule_base.rs b/editoast/editoast_schemas/src/train_schedule/train_schedule_base.rs index 263b5031286..b085c605949 100644 --- a/editoast/editoast_schemas/src/train_schedule/train_schedule_base.rs +++ b/editoast/editoast_schemas/src/train_schedule/train_schedule_base.rs @@ -131,7 +131,7 @@ impl<'de> Deserialize<'de> for TrainScheduleBase { let first_point_id = &internal.path.first().unwrap().id; if schedules .get(first_point_id) - .map_or(false, |s| s.arrival.is_some()) + .is_some_and(|s| s.arrival.is_some()) { return Err(SerdeError::custom( "First path waypoint can't have an arrival time", diff --git a/editoast/src/models/prelude/update.rs b/editoast/src/models/prelude/update.rs index 56cfb444432..0f9dc4077d1 100644 --- a/editoast/src/models/prelude/update.rs +++ b/editoast/src/models/prelude/update.rs @@ -39,7 +39,7 @@ pub struct Patch<'a, T: Model> { } #[allow(unused)] -impl<'a, M: Model> Patch<'a, M> { +impl Patch<'_, M> { /// Applies the patch changeset to update the model instance's row and updates /// the model reference with its new values /// diff --git a/editoast/src/views/infra/edition.rs b/editoast/src/views/infra/edition.rs index e93f9661539..601affd8df8 100644 --- a/editoast/src/views/infra/edition.rs +++ b/editoast/src/views/infra/edition.rs @@ -68,7 +68,7 @@ crate::routes! { (status = 200, body = Vec, description = "The result of the operations") ) )] -async fn edit<'a>( +async fn edit( Path(InfraIdParam { infra_id }): Path, State(AppState { db_pool, @@ -123,7 +123,7 @@ async fn edit<'a>( (status = 200, body = inline(Vec), description = "ID of the trackSections created") ), )] -pub async fn split_track_section<'a>( +pub async fn split_track_section( Path(InfraIdParam { infra_id }): Path, State(AppState { db_pool, diff --git a/editoast/src/views/infra/lines.rs b/editoast/src/views/infra/lines.rs index 5ae3388a939..278bd08f1c6 100644 --- a/editoast/src/views/infra/lines.rs +++ b/editoast/src/views/infra/lines.rs @@ -69,7 +69,7 @@ async fn get_line_bbox( .track_sections() .values() .map(ObjectCache::unwrap_track_section) - .filter(|track| track.line_code.map_or(false, |code| code == line_code)) + .filter(|track| track.line_code == Some(line_code)) .peekable(); if tracksections.peek().is_none() { return Err(LinesErrors::LineNotFound { line_code }.into()); diff --git a/editoast/src/views/infra/pathfinding.rs b/editoast/src/views/infra/pathfinding.rs index de7934c20bc..c1523514d65 100644 --- a/editoast/src/views/infra/pathfinding.rs +++ b/editoast/src/views/infra/pathfinding.rs @@ -210,8 +210,7 @@ impl PathfindingStep { } self.previous - .as_ref() - .map_or(false, |p| p.is_using_switch(switch_id)) + .as_ref().is_some_and(|p| p.is_using_switch(switch_id)) } } diff --git a/editoast/src/views/train_schedule/projection.rs b/editoast/src/views/train_schedule/projection.rs index d2c06c577d2..cd7f3c036ff 100644 --- a/editoast/src/views/train_schedule/projection.rs +++ b/editoast/src/views/train_schedule/projection.rs @@ -374,9 +374,9 @@ async fn compute_batch_signal_updates<'a>( } /// Compute space time curves of a list of train schedules -async fn compute_batch_space_time_curves<'a>( +async fn compute_batch_space_time_curves( trains_details: &Vec, - path_projection: &PathProjection<'a>, + path_projection: &PathProjection<'_>, ) -> HashMap> { let mut space_time_curves = HashMap::new();