Skip to content

Commit f201f61

Browse files
committed
fix clippy
1 parent cb83596 commit f201f61

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

rust/signed_doc/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,19 @@ impl CatalystSignedDocument {
241241
}
242242

243243
/// Returns CBOR bytes.
244+
///
245+
/// # Errors
246+
/// - `minicbor::encode::Error`
244247
pub fn to_bytes(&self) -> anyhow::Result<Vec<u8>> {
245248
let mut e = minicbor::Encoder::new(Vec::new());
246249
self.encode(&mut e, &mut ())?;
247250
Ok(e.into_writer())
248251
}
249252

250253
/// Build `CatalystSignedDoc` instance from CBOR bytes.
254+
///
255+
/// # Errors
256+
/// - `minicbor::decode::Error`
251257
pub fn from_bytes(
252258
bytes: &[u8],
253259
mut policy: CompatibilityPolicy,

rust/signed_doc/src/validator/rules/ownership/mod.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,24 +86,23 @@ impl DocumentOwnershipRule {
8686
doc.report().functional_validation(
8787
&format!(
8888
"Document must only be signed by original author and/or by collaborators defined in the previous version. Allowed signers: {:?}, Document signers: {:?}",
89-
allowed_authors.iter().map(|v| v.to_string()).collect::<Vec<_>>(),
90-
doc_authors.iter().map(|v| v.to_string()).collect::<Vec<_>>()
89+
allowed_authors.iter().map(ToString::to_string).collect::<Vec<_>>(),
90+
doc_authors.iter().map(ToString::to_string).collect::<Vec<_>>()
9191
),
9292
REPORT_CONTEXT,
9393
);
9494
}
9595
return Ok(is_valid);
96-
} else {
97-
// No collaborators are allowed
98-
let is_valid = first_doc.authors() == doc.authors();
99-
if !is_valid {
100-
doc.report().functional_validation(
101-
"Document authors must match the author from the first version",
102-
REPORT_CONTEXT,
103-
);
104-
}
105-
return Ok(is_valid);
10696
}
97+
// No collaborators are allowed
98+
let is_valid = first_doc.authors() == doc.authors();
99+
if !is_valid {
100+
doc.report().functional_validation(
101+
"Document authors must match the author from the first version",
102+
REPORT_CONTEXT,
103+
);
104+
}
105+
return Ok(is_valid);
107106
}
108107

109108
Ok(true)

0 commit comments

Comments
 (0)