From 632ac2905e0db63daae3e2a8e02a4535b950cff2 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 fcd34f260..1b6d9fdc9 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.65" +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 275230c1d..e797dc402 100644 --- a/martin/src/mbtiles/mod.rs +++ b/martin/src/mbtiles/mod.rs @@ -41,12 +41,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 0513a21f2..3af34fd60 100644 --- a/martin/src/pmtiles/mod.rs +++ b/martin/src/pmtiles/mod.rs @@ -39,22 +39,12 @@ impl PmtSource { async fn new(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_source(backend).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()))?; let hdr = &reader.get_header();