Skip to content

Commit

Permalink
journald: fix clippy unwrap_or_default warning (#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 committed Oct 12, 2023
1 parent e1a3846 commit 60b2dc3
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 @@ -107,7 +107,7 @@ impl Layer {
.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 60b2dc3

Please sign in to comment.