Skip to content

Commit

Permalink
tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
hal3e committed May 24, 2024
1 parent b2cf1c5 commit 65b13af
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions src/abi/full_program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,13 @@ impl FullABIFunction {
pub fn doc_strings(&self) -> Result<Vec<String>> {
self.attributes
.iter()
.filter_map(|attr| {
if attr.name == "doc-comment" {
let doc_res = {
if attr.arguments.len() != 1 {
Err(Error(
"`doc-comment` attribute must have one argument".to_string(),
))
} else {
Ok(attr.arguments[0].clone())
}
};

Some(doc_res)
} else {
None
}
.filter(|attr| attr.name == "doc-comment")
.map(|attr| {
(attr.arguments.len() == 1)
.then_some(attr.arguments[0].clone())
.ok_or_else(|| {
Error("`doc-comment` attribute must have one argument".to_string())
})
})
.collect::<Result<Vec<String>>>()
}
Expand Down

0 comments on commit 65b13af

Please sign in to comment.