Skip to content

Commit

Permalink
[tech] Update to clippy 1.51
Browse files Browse the repository at this point in the history
  • Loading branch information
patochectp committed Mar 26, 2021
1 parent 1babf91 commit ad05945
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion ntfs2gtfs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ pub fn add_mode_to_line_code(model: Model) -> Result<Model> {
line.code = code;
}

Ok(Model::new(collections)?)
Model::new(collections)
}
8 changes: 4 additions & 4 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub struct Collections {
//HashMap<(vehicle_journey_id, stop_sequence), comment_id>
pub stop_time_comments: HashMap<(String, u32), String>,
pub prices_v1: Collection<PriceV1>,
pub od_fares_v1: Collection<ODFareV1>,
pub od_fares_v1: Collection<OdFareV1>,
pub fares_v1: Collection<FareV1>,
pub tickets: CollectionWithId<Ticket>,
pub ticket_uses: CollectionWithId<TicketUse>,
Expand Down Expand Up @@ -1484,16 +1484,16 @@ mod tests {
// - stop_point_idx (usize -> index of one of the four test stop points)
// - arrival_time (Time)
// - departure_time (Time)
type VJConfig = (String, usize, Time, Time);
type VjConfig = (String, usize, Time, Time);

// This creates 2 vehicle journeys, each with 2 stop times. There is 4
// available test stop points 'sp0' ―▶ 'sp3'. First vehicle journey has
// a first stop time with 'sp0' and second stop time configurable with
// 'prev_vj_config'. Second vehicle journey has a first stop time
// configurable with 'next_vj_config' and second stop time with 'sp3'.
fn build_vehicle_journeys(
prev_vj_config: VJConfig,
next_vj_config: VJConfig,
prev_vj_config: VjConfig,
next_vj_config: VjConfig,
) -> CollectionWithId<VehicleJourney> {
let mut stop_points = CollectionWithId::default();
let mut sp_idxs = Vec::new();
Expand Down
4 changes: 2 additions & 2 deletions src/ntfs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@ mod tests {
#[test]
fn od_fares_v1_serialization_deserialization() {
test_serialize_deserialize_collection(vec![
ODFareV1 {
OdFareV1 {
origin_stop_area_id: "stop_area:0:SA:8727114".to_string(),
origin_name: Some("EPINAY-S/SEINE".to_string()),
origin_mode: "stop".to_string(),
Expand All @@ -1399,7 +1399,7 @@ mod tests {
destination_mode: "stop".to_string(),
ticket_id: "29".to_string(),
},
ODFareV1 {
OdFareV1 {
origin_stop_area_id: "stop_area:0:SA:8773006".to_string(),
origin_name: None,
origin_mode: "zone".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion src/ntfs/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ pub fn manage_fares_v1(collections: &mut Collections, base_path: &path::Path) ->
.with_context(|_| format!("Error reading {:?}", path))?;
let od_fares_v1 = rdr
.deserialize()
.collect::<std::result::Result<Vec<ODFareV1>, _>>()
.collect::<std::result::Result<Vec<OdFareV1>, _>>()
.with_context(|_| format!("Error reading {:?}", path))?;
collections.od_fares_v1 = Collection::new(od_fares_v1);

Expand Down
2 changes: 1 addition & 1 deletion src/ntfs/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ pub fn write_vehicle_journeys_and_stop_times(
fn do_write_fares_v1(
base_path: &path::Path,
prices_v1: &Collection<PriceV1>,
od_fares_v1: &Collection<ODFareV1>,
od_fares_v1: &Collection<OdFareV1>,
fares_v1: &Collection<FareV1>,
) -> Result<()> {
let file_prices = "prices.csv";
Expand Down
16 changes: 8 additions & 8 deletions src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,12 @@ impl From<Coord> for (String, String) {
}
}

impl From<Coord> for GeoPoint<f64> {
fn from(coord: Coord) -> Self {
GeoPoint::new(coord.lon, coord.lat)
}
}

// Mean Earth radius in meters
const EARTH_RADIUS: f64 = 6_371_000.0;

Expand All @@ -935,12 +941,6 @@ impl From<GeoPoint<f64>> for Coord {
}
}

impl Into<GeoPoint<f64>> for Coord {
fn into(self) -> GeoPoint<f64> {
GeoPoint::new(self.lon, self.lat)
}
}

impl Coord {
/// Calculate the orthodromic distance in meters
/// between 2 geographic coordinates
Expand Down Expand Up @@ -1589,7 +1589,7 @@ impl AddPrefix for PriceV1 {
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct ODFareV1 {
pub struct OdFareV1 {
#[serde(rename = "Origin ID")]
pub origin_stop_area_id: String,
#[serde(rename = "Origin name")]
Expand All @@ -1605,7 +1605,7 @@ pub struct ODFareV1 {
pub ticket_id: String,
}

impl AddPrefix for ODFareV1 {
impl AddPrefix for OdFareV1 {
fn prefix(&mut self, prefix_conf: &PrefixConfiguration) {
self.ticket_id = prefix_conf.referential_prefix(self.ticket_id.as_str());
self.origin_stop_area_id =
Expand Down
2 changes: 1 addition & 1 deletion src/transfers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,5 @@ pub fn generates_transfers(

let mut collections = model.into_collections();
collections.transfers = Collection::new(new_transfers);
Ok(Model::new(collections)?)
Model::new(collections)
}

0 comments on commit ad05945

Please sign in to comment.