Skip to content

Commit

Permalink
journald: fix clippy unwrap_or_default warning (tokio-rs#2742)
Browse files Browse the repository at this point in the history
The latest Clippy emits warnings for uses of `unwrap_or_else` with
functions that return a type's `Default::default` value, such as
`.unwrap_or_else(String::new)`. Clippy would prefer us to use
`unwrap_or_default` instead, which does the same thing.

This commit fixes the lint. Personally, I don't really care about this,
but it makes the warning go away...
  • Loading branch information
hawkw authored and kaffarell committed Nov 10, 2023
1 parent c31edc5 commit faed325
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tracing-journald/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl Subscriber {
.and_then(|p| p.file_name())
.map(|n| n.to_string_lossy().into_owned())
// If we fail to get the name of the current executable fall back to an empty string.
.unwrap_or_else(String::new),
.unwrap_or_default(),
additional_fields: Vec::new(),
};
// Check that we can talk to journald, by sending empty payload which journald discards.
Expand Down

0 comments on commit faed325

Please sign in to comment.