Skip to content

Commit

Permalink
Use Rust 1.74 std::io::Error::other fn
Browse files Browse the repository at this point in the history
  • Loading branch information
nyurik committed Dec 30, 2023
1 parent a44c7d5 commit a89fa33
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/"

Expand Down
7 changes: 1 addition & 6 deletions martin/src/mbtiles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,7 @@ impl MbtSource {
async fn new(id: String, path: PathBuf) -> FileResult<Self> {
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
Expand Down
14 changes: 2 additions & 12 deletions martin/src/pmtiles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,22 +318,12 @@ impl PmtFileSource {
pub async fn new(cache: PmtCache, id: String, path: PathBuf) -> FileResult<Self> {
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
Expand Down

0 comments on commit a89fa33

Please sign in to comment.