chore: Fix mistakes discovered by typos
This commit is contained in:
parent
11cbc2e515
commit
c268e809e9
|
|
@ -104,7 +104,7 @@ impl Version {
|
||||||
pub fn new(n: u32) -> Result<Version, VersionError> {
|
pub fn new(n: u32) -> Result<Version, VersionError> {
|
||||||
match NonZeroU32::new(n) {
|
match NonZeroU32::new(n) {
|
||||||
None => Err(VersionError::ZeroVersion),
|
None => Err(VersionError::ZeroVersion),
|
||||||
Some(n) if n > IDENTITY_VERSION.into() => Err(VersionError::UnkownVersion(n)),
|
Some(n) if n > IDENTITY_VERSION.into() => Err(VersionError::UnknownVersion(n)),
|
||||||
Some(n) => Ok(Version(n)),
|
Some(n) => Ok(Version(n)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -146,7 +146,7 @@ pub enum VersionError {
|
||||||
#[error("the version 0 is not supported")]
|
#[error("the version 0 is not supported")]
|
||||||
ZeroVersion,
|
ZeroVersion,
|
||||||
#[error("unknown identity document version {0}, only version {IDENTITY_VERSION} is supported")]
|
#[error("unknown identity document version {0}, only version {IDENTITY_VERSION} is supported")]
|
||||||
UnkownVersion(NonZeroU32),
|
UnknownVersion(NonZeroU32),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VersionError {
|
impl VersionError {
|
||||||
|
|
@ -155,14 +155,14 @@ impl VersionError {
|
||||||
/// This will give a user more information on how to upgrade to a newer
|
/// This will give a user more information on how to upgrade to a newer
|
||||||
/// version of an identity document, if there is one.
|
/// version of an identity document, if there is one.
|
||||||
pub fn verbose(&self) -> String {
|
pub fn verbose(&self) -> String {
|
||||||
const UNKOWN_VERSION_ERROR: &str = r#"
|
const UNKNOWN_VERSION_ERROR: &str = r#"
|
||||||
Perhaps a new version of the identity document is released which is not supported by the current client.
|
Perhaps a new version of the identity document is released which is not supported by the current client.
|
||||||
See https://radicle.xyz for the latest versions of Radicle.
|
See https://radicle.xyz for the latest versions of Radicle.
|
||||||
The CLI command `rad id migrate` will help to migrate to an up-to-date versions."#;
|
The CLI command `rad id migrate` will help to migrate to an up-to-date versions."#;
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
err @ Self::ZeroVersion => err.to_string(),
|
err @ Self::ZeroVersion => err.to_string(),
|
||||||
err @ Self::UnkownVersion(_) => format!("{err}{UNKOWN_VERSION_ERROR}"),
|
err @ Self::UnknownVersion(_) => format!("{err}{UNKNOWN_VERSION_ERROR}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1038,7 +1038,7 @@ mod test {
|
||||||
serde_json::from_str::<Version>(&v)
|
serde_json::from_str::<Version>(&v)
|
||||||
.expect_err("should fail to deserialize")
|
.expect_err("should fail to deserialize")
|
||||||
.to_string(),
|
.to_string(),
|
||||||
VersionError::UnkownVersion(NonZeroU32::MAX).to_string(),
|
VersionError::UnknownVersion(NonZeroU32::MAX).to_string(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ impl Store for Database {
|
||||||
|
|
||||||
for row in stmt.into_iter() {
|
for row in stmt.into_iter() {
|
||||||
let row = row?;
|
let row = row?;
|
||||||
let _typ = row.try_read::<AddressType, _>("type")?;
|
let _type = row.try_read::<AddressType, _>("type")?;
|
||||||
let addr = row.try_read::<Address, _>("value")?;
|
let addr = row.try_read::<Address, _>("value")?;
|
||||||
let source = row.try_read::<Source, _>("source")?;
|
let source = row.try_read::<Source, _>("source")?;
|
||||||
let last_attempt = row
|
let last_attempt = row
|
||||||
|
|
@ -300,7 +300,7 @@ impl Store for Database {
|
||||||
|
|
||||||
while let Some(Ok(row)) = stmt.next() {
|
while let Some(Ok(row)) = stmt.next() {
|
||||||
let node = row.try_read::<NodeId, _>("node")?;
|
let node = row.try_read::<NodeId, _>("node")?;
|
||||||
let _typ = row.try_read::<AddressType, _>("type")?;
|
let _type = row.try_read::<AddressType, _>("type")?;
|
||||||
let addr = row.try_read::<Address, _>("value")?;
|
let addr = row.try_read::<Address, _>("value")?;
|
||||||
let source = row.try_read::<Source, _>("source")?;
|
let source = row.try_read::<Source, _>("source")?;
|
||||||
let last_success = row.try_read::<Option<i64>, _>("last_success")?;
|
let last_success = row.try_read::<Option<i64>, _>("last_success")?;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue