Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ jobs:
- name: Check formatting
run: cargo fmt --check
- name: Run clippy
run: cargo clippy --all-targets --all-features -- -D warnings -A clippy::pedantic
run: cargo clippy --all-targets --all-features -- -D warnings -W clippy::pedantic -W clippy::nursery
- name: Run audit
run: cargo install cargo-audit && cargo audit
35 changes: 17 additions & 18 deletions src/client/blame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,20 @@ fn is_file_author(response_data: &blame::ResponseData, login: &str) -> bool {

// println!("\n\nRanges: {:?}\n\n", v);

let authors = match v {
Some(ranges) => ranges
.iter()
.filter_map(|range| range.commit.authors.nodes.as_ref())
.flatten()
.filter_map(|node| {
node.as_ref()
.and_then(|n| n.user.as_ref().map(|user| user.login.as_str()))
})
.collect(),
_ => vec![],
};
let authors = v.map_or_else(
Vec::new,
|ranges| {
ranges
.iter()
.filter_map(|range| range.commit.authors.nodes.as_ref())
.flatten()
.filter_map(|node| {
node.as_ref()
.and_then(|n| n.user.as_ref().map(|user| user.login.as_str()))
})
.collect()
},
);

// println!("\n\n Authors: {:?}\n\n", authors);
let login_str: String = login.to_string();
Expand Down Expand Up @@ -119,11 +121,8 @@ async fn girhub_blame(
}
Err(anyhow!("Errors fetching the authors of {path} {error_str}",))
} else {
match response_body.data {
Some(data) => Ok(data),
None => Err(anyhow!(
"Missing response data fetching the authors of {path}"
)),
}
response_body
.data
.map_or_else(|| Err(anyhow!("Missing response data fetching the authors of {path}")), Ok)
}
}
Loading
Loading