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 86b7c54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ fn events_per_author(events: Vec<RawEvent>) -> HashMap<String, Vec<RawEvent>> {
.fold(HashMap::new(), |mut acc, event: RawEvent| {
(*acc
.entry(event.actor.login.clone())
.or_insert_with(Vec::new))
.or_default())
.push(event);
acc
})
Expand Down

0 comments on commit 86b7c54

Please sign in to comment.