Remove imports of anyhow::Error and use named path anyhow::Error in place.

This is done for the same reason as for anyhow::Result and
core::result::Result types.

Error is whidely used name and IMO it usually good to keep it standard.
Apart from that I think assosicated type specification looks fore
readable when anyhow::Error is used in place. For example:

    type Error = Error;

was replaced with

    type Error = anyhow::Error;

Changes:
- Replace usage of imported unquolified Error type with anyhow::Error.
- Remove imports of anyhow::Error.
This commit is contained in:
Zeke Fast
2025-04-29 00:29:03 +02:00
parent 4d57dc1eb2
commit 0bea4f0f2a

View File

@@ -2,7 +2,7 @@ use std::convert::TryFrom;
use std::fmt;
use std::str::FromStr;
use anyhow::{Error, anyhow};
use anyhow::anyhow;
use hex::ToHex;
use r2d2_sqlite::rusqlite::types::FromSql;
use r2d2_sqlite::rusqlite::types::FromSqlError;
@@ -47,7 +47,7 @@ impl ToSql for Email {
}
impl TryFrom<&UserID> for Email {
type Error = Error;
type Error = anyhow::Error;
fn try_from(uid: &UserID) -> anyhow::Result<Self> {
if let Some(address) = uid.email2()? {
@@ -90,7 +90,7 @@ impl fmt::Display for Email {
}
impl FromStr for Email {
type Err = Error;
type Err = anyhow::Error;
fn from_str(s: &str) -> anyhow::Result<Email> {
Email::try_from(&UserID::from(s))
@@ -117,7 +117,7 @@ impl ToSql for Fingerprint {
}
impl TryFrom<sequoia_openpgp::Fingerprint> for Fingerprint {
type Error = Error;
type Error = anyhow::Error;
fn try_from(fpr: sequoia_openpgp::Fingerprint) -> anyhow::Result<Self> {
match fpr {
@@ -156,7 +156,7 @@ impl<'de> Deserialize<'de> for Fingerprint {
}
impl FromStr for Fingerprint {
type Err = Error;
type Err = anyhow::Error;
fn from_str(s: &str) -> anyhow::Result<Fingerprint> {
match sequoia_openpgp::Fingerprint::from_hex(s)? {
@@ -189,7 +189,7 @@ impl ToSql for KeyID {
}
impl TryFrom<sequoia_openpgp::Fingerprint> for KeyID {
type Error = Error;
type Error = anyhow::Error;
fn try_from(fpr: sequoia_openpgp::Fingerprint) -> anyhow::Result<Self> {
match fpr {
@@ -225,7 +225,7 @@ impl fmt::Display for KeyID {
}
impl FromStr for KeyID {
type Err = Error;
type Err = anyhow::Error;
fn from_str(s: &str) -> anyhow::Result<KeyID> {
match sequoia_openpgp::KeyID::from_hex(s)? {