mirror of
https://seed.radicle.dev/rad:z6cFWeWpnZNHh9rUW8phgA3b5yGt.git
synced 2026-10-18 19:10:31 +08:00
clippy: use io::Error::other
Use the helper constructor to build I/O errors with the `Other` kind.
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user