From 75b4869ca1f7ee4e5f3918210cfb41368da965cc Mon Sep 17 00:00:00 2001 From: David Quintanel Date: Thu, 10 Mar 2022 18:59:36 +0100 Subject: [PATCH 1/3] upgrade packages --- Cargo.toml | 6 +++--- gtfs2netexfr/Cargo.toml | 4 ++-- gtfs2ntfs/Cargo.toml | 4 ++-- ntfs2gtfs/Cargo.toml | 4 ++-- ntfs2netexfr/Cargo.toml | 4 ++-- ntfs2ntfs/Cargo.toml | 4 ++-- restrict-validity-period/Cargo.toml | 2 +- src/serde_utils.rs | 3 ++- 8 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ebb17ad01..cb705e8e7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] authors = ["Kisio Digital ", "Guillaume Pinot "] name = "transit_model" -version = "0.48.1" +version = "0.49.0" license = "AGPL-3.0-only" description = "Transit data management" repository = "https://github.com/CanalTP/transit_model" @@ -43,7 +43,7 @@ chrono = { version = "0.4", default-features = false, features = ["std", "clock" chrono-tz = { version = "0.6", features = ["serde"] } csv = "1" derivative = "2" -geo = "0.18" +geo = "0.19" iso4217 = "0.3" lazy_static = "1" md5 = "0.7" @@ -66,7 +66,7 @@ thiserror = "1" tracing = { version = "0.1", features = ["log", "release_max_level_info"] } typed_index_collection = "2" walkdir = "2" -wkt = "0.9" +wkt = "0.10" zip = { version = "0.5", default-features = false, features = ["deflate"] } git-version = "0.3" diff --git a/gtfs2netexfr/Cargo.toml b/gtfs2netexfr/Cargo.toml index a47ae7464..fc22ea7ed 100644 --- a/gtfs2netexfr/Cargo.toml +++ b/gtfs2netexfr/Cargo.toml @@ -17,10 +17,10 @@ chrono = { version = "0.4", default-features = false, features = ["std", "clock" structopt = "0.3" tracing = { version = "0.1", features = ["log", "release_max_level_info"] } tracing-log = "0.1" -tracing-subscriber = "0.2" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } transit_model = { path = "../", features = ["proj"] } lazy_static = "1" [dev-dependencies] -assert_cmd = "1" +assert_cmd = "2" tempfile = "3" diff --git a/gtfs2ntfs/Cargo.toml b/gtfs2ntfs/Cargo.toml index 697bacb9b..76559ba01 100644 --- a/gtfs2ntfs/Cargo.toml +++ b/gtfs2ntfs/Cargo.toml @@ -17,10 +17,10 @@ chrono = { version = "0.4", default-features = false, features = ["std", "clock" structopt = "0.3" tracing = { version = "0.1", features = ["log", "release_max_level_info"] } tracing-log = "0.1" -tracing-subscriber = "0.2" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } transit_model = { path = "../" } lazy_static = "1" [dev-dependencies] -assert_cmd = "1" +assert_cmd = "2" tempfile = "3" diff --git a/ntfs2gtfs/Cargo.toml b/ntfs2gtfs/Cargo.toml index 479091b87..595c5e664 100644 --- a/ntfs2gtfs/Cargo.toml +++ b/ntfs2gtfs/Cargo.toml @@ -17,10 +17,10 @@ chrono = { version = "0.4", default-features = false, features = ["std", "clock" structopt = "0.3" tracing = { version = "0.1", features = ["log", "release_max_level_info"] } tracing-log = "0.1" -tracing-subscriber = "0.2" +tracing-subscriber = "0.3" transit_model = { path = "../" } lazy_static = "1" [dev-dependencies] -assert_cmd = "1" +assert_cmd = "2" tempfile = "3" diff --git a/ntfs2netexfr/Cargo.toml b/ntfs2netexfr/Cargo.toml index 65d2277aa..6a7e54c87 100644 --- a/ntfs2netexfr/Cargo.toml +++ b/ntfs2netexfr/Cargo.toml @@ -17,10 +17,10 @@ chrono = { version = "0.4", default-features = false, features = ["std", "clock" structopt = "0.3" tracing = { version = "0.1", features = ["log", "release_max_level_info"] } tracing-log = "0.1" -tracing-subscriber = "0.2" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } transit_model = { path = "../", features = ["proj"] } lazy_static = "1" [dev-dependencies] -assert_cmd = "1" +assert_cmd = "2" tempfile = "3" diff --git a/ntfs2ntfs/Cargo.toml b/ntfs2ntfs/Cargo.toml index 5310c41e1..1701bcf1a 100644 --- a/ntfs2ntfs/Cargo.toml +++ b/ntfs2ntfs/Cargo.toml @@ -17,10 +17,10 @@ chrono = { version = "0.4", default-features = false, features = ["std", "clock" structopt = "0.3" tracing = { version = "0.1", features = ["log", "release_max_level_info"] } tracing-log = "0.1" -tracing-subscriber = "0.2" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } transit_model = { path = "../" } lazy_static = "1" [dev-dependencies] -assert_cmd = "1" +assert_cmd = "2" tempfile = "3" diff --git a/restrict-validity-period/Cargo.toml b/restrict-validity-period/Cargo.toml index 7a21e36df..3f7fe212e 100644 --- a/restrict-validity-period/Cargo.toml +++ b/restrict-validity-period/Cargo.toml @@ -16,5 +16,5 @@ chrono = { version = "0.4", default-features = false, features = ["std", "clock" structopt = "0.3" tracing = { version = "0.1", features = ["log", "release_max_level_info"] } tracing-log = "0.1" -tracing-subscriber = "0.2" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } transit_model = { path = "../" } diff --git a/src/serde_utils.rs b/src/serde_utils.rs index 10df171ad..4ced15ce3 100644 --- a/src/serde_utils.rs +++ b/src/serde_utils.rs @@ -150,6 +150,7 @@ where D: serde::Deserializer<'de>, { use serde::Deserialize; + use std::str::FromStr; let s = String::deserialize(deserializer)?; let wkt = wkt::Wkt::from_str(&s).map_err(serde::de::Error::custom)?; use std::convert::TryInto; @@ -275,7 +276,7 @@ where S: serde::Serializer, { let wkt = geometry.to_wkt(); - serializer.serialize_str(&format!("{}", wkt.items[0])) + serializer.serialize_str(&format!("{}", wkt.item)) } /// deserialyse optional String From 6703056df7c15e8b2a28452a62479e93e62ae0b2 Mon Sep 17 00:00:00 2001 From: David Quintanel Date: Fri, 11 Mar 2022 09:09:11 +0100 Subject: [PATCH 2/3] upgrade proj --- Cargo.toml | 2 +- src/netex_france/exporter.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cb705e8e7..069cf5e2a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,7 +54,7 @@ minidom_ext = "1" minidom_writer = "1" num-traits = "0.2" pretty_assertions = "1" -proj = { version = "0.24", optional = true } # libproj version used by 'proj' crate must be propagated to CI and makefile +proj = { version = "0.25", optional = true } # libproj version used by 'proj' crate must be propagated to CI and makefile quick-xml = "0.22" relational_types = "2" rust_decimal = "1" diff --git a/src/netex_france/exporter.rs b/src/netex_france/exporter.rs index d1db2c358..2a6429921 100644 --- a/src/netex_france/exporter.rs +++ b/src/netex_france/exporter.rs @@ -175,7 +175,7 @@ impl<'a> Exporter<'a> { let from = "+proj=longlat +datum=WGS84 +no_defs"; // https://epsg.io/4326 let to = "+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"; // https://epsg.io/2154 Proj::new_known_crs(from, to, None) - .ok_or_else(|| anyhow!("Proj cannot build a converter from '{}' to '{}'", from, to)) + .map_err(|_| anyhow!("Proj cannot build a converter from '{}' to '{}'", from, to)) } } From bceb00832e62322e48d37f331bd55212bfc40f67 Mon Sep 17 00:00:00 2001 From: David Quintanel Date: Fri, 11 Mar 2022 09:25:42 +0100 Subject: [PATCH 3/3] clippy --- src/ntfs/read.rs | 2 +- src/ntfs/write.rs | 2 +- src/objects.rs | 2 +- src/serde_utils.rs | 4 ++-- src/vptranslator.rs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ntfs/read.rs b/src/ntfs/read.rs index 3695fd8aa..1863cf8e0 100644 --- a/src/ntfs/read.rs +++ b/src/ntfs/read.rs @@ -295,7 +295,7 @@ where |v| v != 0, ); - let precision = stop_time.precision.or_else(|| { + let precision = stop_time.precision.or({ if datetime_estimated { Some(StopTimePrecision::Estimated) } else { diff --git a/src/ntfs/write.rs b/src/ntfs/write.rs index d5afc6eaf..f41972176 100644 --- a/src/ntfs/write.rs +++ b/src/ntfs/write.rs @@ -267,7 +267,7 @@ fn build_price_v1(id: &str, ticket: &Ticket, price: &TicketPrice) -> Result 59 || seconds > 59 { return Err(TimeError::WrongValue); diff --git a/src/serde_utils.rs b/src/serde_utils.rs index 4ced15ce3..7bbbb6934 100644 --- a/src/serde_utils.rs +++ b/src/serde_utils.rs @@ -130,7 +130,7 @@ where { use serde::Deserialize; let option = Option::::deserialize(de)?; - Ok(option.map(|s| s.replace("/", ""))) + Ok(option.map(|s| s.replace('/', ""))) } /// deserialize type @@ -267,7 +267,7 @@ where use serde::ser::Error; let currency_code = iso4217::alpha3(currency_code) .ok_or_else(|| S::Error::custom("The String is not a valid currency code (ISO-4217)"))?; - serializer.serialize_str(¤cy_code.alpha3.to_string()) + serializer.serialize_str(currency_code.alpha3) } /// serialize geometry to wkt diff --git a/src/vptranslator.rs b/src/vptranslator.rs index 57e11ed58..05138f5eb 100644 --- a/src/vptranslator.rs +++ b/src/vptranslator.rs @@ -324,7 +324,7 @@ mod tests { fn empty_vp() { let res = translate(&get_dates_from_bitset( Date::from_ymd(2012, 7, 16), - &"0000000".to_string(), + "0000000", )); assert_eq!(0b000_0000, get_week_from_weekday(res.operating_days));