From a89fa33958495d7c7a2c412f2009a8e3c9b0ee1a Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Fri, 17 Nov 2023 00:04:20 -0500 Subject: [PATCH] Use Rust 1.74 std::io::Error::other fn --- Cargo.toml | 2 +- martin/src/mbtiles/mod.rs | 7 +------ martin/src/pmtiles/mod.rs | 14 ++------------ 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 033c2a8fc..fa540a7fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ members = ["martin", "martin-tile-utils", "mbtiles"] edition = "2021" license = "MIT OR Apache-2.0" repository = "https://github.com/maplibre/martin" -rust-version = "1.70" +rust-version = "1.74" readme = "README.md" homepage = "https://martin.maplibre.org/" diff --git a/martin/src/mbtiles/mod.rs b/martin/src/mbtiles/mod.rs index 3029fed04..d9ea2dfcd 100644 --- a/martin/src/mbtiles/mod.rs +++ b/martin/src/mbtiles/mod.rs @@ -63,12 +63,7 @@ impl MbtSource { async fn new(id: String, path: PathBuf) -> FileResult { let mbt = MbtilesPool::new(&path) .await - .map_err(|e| { - io::Error::new( - io::ErrorKind::Other, - format!("{e:?}: Cannot open file {}", path.display()), - ) - }) + .map_err(|e| io::Error::other(format!("{e:?}: Cannot open file {}", path.display()))) .map_err(|e| IoError(e, path.clone()))?; let meta = mbt diff --git a/martin/src/pmtiles/mod.rs b/martin/src/pmtiles/mod.rs index ec6514531..9fd8c456f 100644 --- a/martin/src/pmtiles/mod.rs +++ b/martin/src/pmtiles/mod.rs @@ -318,22 +318,12 @@ impl PmtFileSource { pub async fn new(cache: PmtCache, id: String, path: PathBuf) -> FileResult { let backend = MmapBackend::try_from(path.as_path()) .await - .map_err(|e| { - io::Error::new( - io::ErrorKind::Other, - format!("{e:?}: Cannot open file {}", path.display()), - ) - }) + .map_err(|e| io::Error::other(format!("{e:?}: Cannot open file {}", path.display()))) .map_err(|e| IoError(e, path.clone()))?; let reader = AsyncPmTilesReader::try_from_cached_source(backend, cache).await; let reader = reader - .map_err(|e| { - io::Error::new( - io::ErrorKind::Other, - format!("{e:?}: Cannot open file {}", path.display()), - ) - }) + .map_err(|e| io::Error::other(format!("{e:?}: Cannot open file {}", path.display()))) .map_err(|e| IoError(e, path.clone()))?; Self::new_int(id, path, reader).await