From 60b2dc34662648b91d69b2fa51d18d3677ddbce7 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Mon, 9 Oct 2023 09:28:14 -0700 Subject: [PATCH] journald: fix clippy `unwrap_or_default` warning (#2742) 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... --- tracing-journald/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tracing-journald/src/lib.rs b/tracing-journald/src/lib.rs index fc7263086b..10c6f1b974 100644 --- a/tracing-journald/src/lib.rs +++ b/tracing-journald/src/lib.rs @@ -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.