Skip to content

Commit

Permalink
🚨 Fix Clippy error 'use_or_insert_with'
Browse files Browse the repository at this point in the history
Fixes CI failing with commit 6db5049:

	error: use of `or_insert_with` to construct default value
	Error:    --> src/lib.rs:115:18
	    |
	115 |                 .or_insert_with(Vec::new))
	    |                  ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
	    |
	    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
	    = note: `-D clippy::unwrap-or-default` implied by `-D warnings`

https://github.com/nicokosi/pullpito/actions/runs/6887187730/job/18733990115

Seems related to Cargo 1.73 update.

I had to uninstall Hombrew-installed Rust to reproduce locally:

	brew rm rust # Cargo 1.72.1
  • Loading branch information
nicokosi committed Nov 20, 2023
1 parent 6db5049 commit 0c4e29f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,7 @@ fn events_per_author(events: Vec<RawEvent>) -> HashMap<String, Vec<RawEvent>> {
|| e.event_type == Type::IssueCommentEvent
})
.fold(HashMap::new(), |mut acc, event: RawEvent| {
(*acc
.entry(event.actor.login.clone())
.or_insert_with(Vec::new))
.push(event);
(*acc.entry(event.actor.login.clone()).or_default()).push(event);
acc
})
}
Expand Down

0 comments on commit 0c4e29f

Please sign in to comment.