clippy: use io::Error::other

Use the helper constructor to build I/O errors with the `Other` kind.
This commit is contained in:
Fintan Halpenny
2025-12-08 15:11:21 +00:00
parent 68d6fa879f
commit 10333caec7
4 changed files with 6 additions and 8 deletions
+1 -1
View File
@@ -13,5 +13,5 @@ pub fn into_git_err<E: Display>(e: E) -> git2::Error {
}
pub fn into_io_err(e: git2::Error) -> io::Error {
io::Error::new(io::ErrorKind::Other, e)
io::Error::other(e)
}
+3 -5
View File
@@ -159,7 +159,7 @@ proptest! {
#[test]
fn valid_commits(commits in proptest::collection::vec(gen::commit::commit(), 5..20)) {
let repo = tempdir::WithTmpDir::new(|path| {
git2::Repository::init(path).map_err(|e| io::Error::new(io::ErrorKind::Other, e))
git2::Repository::init(path).map_err(io::Error::other)
}).unwrap();
let commits = gen::commit::write_commits(&repo, commits).unwrap();
repo.reference("refs/heads/master", *commits.last().unwrap(), true, "").unwrap();
@@ -177,10 +177,8 @@ proptest! {
#[test]
fn write_valid_commit() {
let repo = WithTmpDir::new(|path| {
git2::Repository::init(path).map_err(|err| io::Error::new(io::ErrorKind::Other, err))
})
.unwrap();
let repo =
WithTmpDir::new(|path| git2::Repository::init(path).map_err(io::Error::other)).unwrap();
let author = Author {
name: "Terry".to_owned(),
+1 -1
View File
@@ -87,5 +87,5 @@ fn io_other<E>(e: E) -> io::Error
where
E: std::error::Error + Send + Sync + 'static,
{
io::Error::new(io::ErrorKind::Other, e)
io::Error::other(e)
}