diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b936522e..9f3a3e30 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -175,7 +175,7 @@ jobs: submodules: true - uses: ./.github/actions/setup-rust with: - version: 1.70.0 + version: 1.74.0 - run: rustup toolchain install nightly - run: rm Cargo.lock && cargo +nightly update -Z direct-minimal-versions - run: cargo test @@ -312,7 +312,7 @@ jobs: submodules: true - uses: ./.github/actions/setup-rust with: - version: 1.70.0 + version: 1.74.0 - run: rustup toolchain install nightly - uses: actions/setup-python@v4 with: diff --git a/Cargo.toml b/Cargo.toml index 7cbc711b..d13f9d14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ version = "0.4.0-alpha.3-dev" authors = ["Tpt "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.70" +rust-version = "1.74" [workspace.dependencies] anyhow = "1.0.72" diff --git a/lib/oxigraph/src/sparql/error.rs b/lib/oxigraph/src/sparql/error.rs index b3516d8e..4312e559 100644 --- a/lib/oxigraph/src/sparql/error.rs +++ b/lib/oxigraph/src/sparql/error.rs @@ -138,7 +138,7 @@ impl From for io::Error { EvaluationError::Storage(error) => error.into(), EvaluationError::Service(error) => match error.downcast() { Ok(error) => *error, - Err(error) => Self::new(io::ErrorKind::Other, error), + Err(error) => Self::other(error), }, EvaluationError::GraphAlreadyExists(_) | EvaluationError::GraphDoesNotExist(_) diff --git a/lib/oxigraph/src/sparql/http/simple.rs b/lib/oxigraph/src/sparql/http/simple.rs index bd81d7ce..49251818 100644 --- a/lib/oxigraph/src/sparql/http/simple.rs +++ b/lib/oxigraph/src/sparql/http/simple.rs @@ -26,15 +26,10 @@ impl Client { let response = self.client.request(request)?; let status = response.status(); if !status.is_successful() { - return Err(Error::new( - ErrorKind::Other, - format!( - "Error {} returned by {} with payload:\n{}", - status, - url, - response.into_body().to_string()? - ), - )); + return Err(Error::other(format!( + "Error {status} returned by {url} with payload:\n{}", + response.into_body().to_string()? + ))); } let content_type = response .header(&HeaderName::CONTENT_TYPE) @@ -61,15 +56,10 @@ impl Client { let response = self.client.request(request)?; let status = response.status(); if !status.is_successful() { - return Err(Error::new( - ErrorKind::Other, - format!( - "Error {} returned by {} with payload:\n{}", - status, - url, - response.into_body().to_string()? - ), - )); + return Err(Error::other(format!( + "Error {status} returned by {url} with payload:\n{}", + response.into_body().to_string()? + ))); } let content_type = response .header(&HeaderName::CONTENT_TYPE) diff --git a/lib/oxigraph/src/storage/backend/rocksdb.rs b/lib/oxigraph/src/storage/backend/rocksdb.rs index fed85421..d96845b0 100644 --- a/lib/oxigraph/src/storage/backend/rocksdb.rs +++ b/lib/oxigraph/src/storage/backend/rocksdb.rs @@ -456,14 +456,11 @@ impl Db { if let Some(available_fd) = available_file_descriptors()? { if available_fd < 96 { rocksdb_options_destroy(options); - return Err(io::Error::new( - io::ErrorKind::Other, - format!( - "Oxigraph needs at least 96 file descriptors, \ + return Err(io::Error::other(format!( + "Oxigraph needs at least 96 file descriptors, \ only {available_fd} allowed. \ Run e.g. `ulimit -n 512` to allow 512 opened files" - ), - ) + )) .into()); } rocksdb_options_set_max_open_files( diff --git a/lib/oxigraph/src/storage/error.rs b/lib/oxigraph/src/storage/error.rs index 05076e6e..96c3a83a 100644 --- a/lib/oxigraph/src/storage/error.rs +++ b/lib/oxigraph/src/storage/error.rs @@ -50,7 +50,7 @@ impl From for io::Error { match error { StorageError::Io(error) => error, StorageError::Corruption(error) => error.into(), - StorageError::Other(error) => Self::new(io::ErrorKind::Other, error), + StorageError::Other(error) => Self::other(error), } } } diff --git a/lib/oxigraph/src/storage/mod.rs b/lib/oxigraph/src/storage/mod.rs index 1f77d1b0..075287f4 100644 --- a/lib/oxigraph/src/storage/mod.rs +++ b/lib/oxigraph/src/storage/mod.rs @@ -1316,7 +1316,7 @@ impl StorageBulkLoader { ) -> Result<(), StorageError> { let new_counter = *done .lock() - .map_err(|_| io::Error::new(io::ErrorKind::Other, "Mutex poisoned"))?; + .map_err(|_| io::Error::other("Mutex poisoned"))?; let display_step = DEFAULT_BULK_LOAD_BATCH_SIZE as u64; if new_counter / display_step > *done_and_displayed / display_step { for hook in &self.hooks { @@ -1355,7 +1355,7 @@ impl<'a> FileBulkLoader<'a> { self.save()?; *counter .lock() - .map_err(|_| io::Error::new(io::ErrorKind::Other, "Mutex poisoned"))? += + .map_err(|_| io::Error::other("Mutex poisoned"))? += size.try_into().unwrap_or(u64::MAX); Ok(()) } @@ -1546,13 +1546,10 @@ impl<'a> FileBulkLoader<'a> { #[cfg(not(target_family = "wasm"))] fn map_thread_result(result: thread::Result) -> io::Result { result.map_err(|e| { - io::Error::new( - io::ErrorKind::Other, - if let Ok(e) = e.downcast::<&dyn std::fmt::Display>() { - format!("A loader processed crashed with {e}") - } else { - "A loader processed crashed with and unknown error".into() - }, - ) + io::Error::other(if let Ok(e) = e.downcast::<&dyn std::fmt::Display>() { + format!("A loader processed crashed with {e}") + } else { + "A loader processed crashed with and unknown error".into() + }) }) } diff --git a/lib/oxrdfxml/src/serializer.rs b/lib/oxrdfxml/src/serializer.rs index 742b026e..1950b2ca 100644 --- a/lib/oxrdfxml/src/serializer.rs +++ b/lib/oxrdfxml/src/serializer.rs @@ -421,7 +421,7 @@ fn map_err(error: quick_xml::Error) -> io::Error { if let quick_xml::Error::Io(error) = error { Arc::try_unwrap(error).unwrap_or_else(|error| io::Error::new(error.kind(), error)) } else { - io::Error::new(io::ErrorKind::Other, error) + io::Error::other(error) } }