Skip to content

Commit

Permalink
Quick linter cleanup (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianthetechie authored Dec 13, 2024
1 parent 6bd12a1 commit 81d50af
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
1 change: 1 addition & 0 deletions common/ferrostar/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ mod uniffi_deps {
pub use uuid::Uuid;
}
#[cfg(feature = "uniffi")]
#[allow(clippy::wildcard_imports)]
use uniffi_deps::*;

#[cfg(feature = "uniffi")]
Expand Down
2 changes: 2 additions & 0 deletions common/ferrostar/src/navigation_controller/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ pub struct TripProgress {
#[cfg_attr(any(feature = "wasm-bindgen", test), derive(Serialize, Deserialize))]
#[cfg_attr(feature = "wasm-bindgen", derive(Tsify))]
#[cfg_attr(feature = "wasm-bindgen", tsify(into_wasm_abi, from_wasm_abi))]
#[allow(clippy::large_enum_variant)]
pub enum TripState {
/// The navigation controller is idle and there is no active trip.
Idle,
Expand Down Expand Up @@ -83,6 +84,7 @@ pub enum TripState {
Complete,
}

#[allow(clippy::large_enum_variant)]
pub enum StepAdvanceStatus {
/// Navigation has advanced, and the information on the next step is embedded.
Advanced {
Expand Down
10 changes: 5 additions & 5 deletions common/ferrostar/src/routing_adapters/osrm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl Route {
// Index for the annotations slice
let mut start_index: usize = 0;

return leg.steps.iter().map(move |step| {
leg.steps.iter().map(move |step| {
let step_geometry =
get_coordinates_from_geometry(&step.geometry, polyline_precision)?;

Expand Down Expand Up @@ -157,21 +157,21 @@ impl Route {
end_index as u64
} else {
adjusted_end
})
});
}
adjusted_incident
})
.collect::<Vec<Incident>>();

start_index = end_index;

return RouteStep::from_osrm_and_geom(
RouteStep::from_osrm_and_geom(
step,
step_geometry,
annotation_slice,
relevant_incidents_slice,
);
});
)
})
})
.collect::<Result<Vec<_>, _>>()?;

Expand Down
12 changes: 6 additions & 6 deletions common/ferrostar/src/routing_adapters/osrm/utilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ pub(crate) fn get_annotation_slice(
.map(<[AnyAnnotationValue]>::to_vec)
}

/// Converts the the OSRM-style annotation object consisting of separate arrays
/// Converts the OSRM-style annotation object consisting of separate arrays
/// to a single vector of parsed objects (one for each coordinate pair).
pub(crate) fn zip_annotations(annotation: AnyAnnotation) -> Vec<AnyAnnotationValue> {
let source: HashMap<String, Vec<Value>> = annotation.values;

// Get the length of the array (assumed to be the same for all annotations)
let length = source.values().next().map_or(0, Vec::len);

return (0..length)
(0..length)
.map(|i| {
source
.iter()
Expand All @@ -44,7 +44,7 @@ pub(crate) fn zip_annotations(annotation: AnyAnnotation) -> Vec<AnyAnnotationVal
.collect::<HashMap<String, Value>>() // Collect the key-value pairs into a hashmap.
})
.map(|value| AnyAnnotationValue { value })
.collect::<Vec<AnyAnnotationValue>>();
.collect::<Vec<AnyAnnotationValue>>()
}

impl From<&MapboxOsrmIncident> for Incident {
Expand All @@ -54,9 +54,9 @@ impl From<&MapboxOsrmIncident> for Incident {
incident_type: incident.incident_type,
description: incident.description.clone(),
long_description: incident.long_description.clone(),
creation_time: incident.creation_time.clone(),
start_time: incident.start_time.clone(),
end_time: incident.end_time.clone(),
creation_time: incident.creation_time,
start_time: incident.start_time,
end_time: incident.end_time,
impact: incident.impact,
lanes_blocked: incident.lanes_blocked.clone(),
congestion: incident.congestion.clone(),
Expand Down
2 changes: 1 addition & 1 deletion common/ferrostar/src/routing_adapters/valhalla.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl ValhallaHttpRequestGenerator {
profile: String,
options_json: Option<&str>,
) -> Result<Self, InstantiationError> {
let parsed_options = match options_json.as_deref() {
let parsed_options = match options_json {
// TODO: Another error variant
Some(options) => serde_json::from_str::<JsonValue>(options)?
.as_object()
Expand Down
2 changes: 1 addition & 1 deletion common/ferrostar/src/simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ fn add_lateral_offset(
let lateral_bearing_rad = (bearing + sign * 90.0).to_radians();

// offset to approximate degrees
let offset_deg = meters / 111111.0;
let offset_deg = meters / 111_111.0;

let lat_offset = offset_deg * lateral_bearing_rad.cos();
let lng_offset = offset_deg * lateral_bearing_rad.sin();
Expand Down

0 comments on commit 81d50af

Please sign in to comment.