From a87bc9f9291fe707900f3434a8bdc7803366eb44 Mon Sep 17 00:00:00 2001 From: ZauJulio Date: Mon, 27 Feb 2023 01:13:16 -0300 Subject: [PATCH] mktemp: remove unnecessary convertion for path -> str just use prefix_from_template --- src/uu/mktemp/src/mktemp.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index 1764b8e84..5d4308958 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -281,11 +281,7 @@ impl Params { .join(prefix_from_template) .display() .to_string(); - - // Check that the prefix is valid. - let prefix_of_template = Path::new(prefix_from_template).to_string_lossy(); - - if options.treat_as_template && prefix_of_template.contains(MAIN_SEPARATOR) { + if options.treat_as_template && prefix_from_template.contains(MAIN_SEPARATOR) { return Err(MkTempError::PrefixContainsDirSeparator(options.template)); } if tmpdir.is_some() && Path::new(prefix_from_template).is_absolute() {