From c9babe4e6f5d2509c00d9c2b33ab281f57590dc9 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Mon, 21 Apr 2025 23:47:08 +0200 Subject: [PATCH] mknod: pass a string instead of matches --- src/uu/mknod/src/mknod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/mknod/src/mknod.rs b/src/uu/mknod/src/mknod.rs index 77d7f3617..561fe1acc 100644 --- a/src/uu/mknod/src/mknod.rs +++ b/src/uu/mknod/src/mknod.rs @@ -101,7 +101,7 @@ fn _mknod(file_name: &str, config: Config) -> i32 { pub fn uumain(args: impl uucore::Args) -> UResult<()> { let matches = uu_app().try_get_matches_from(args)?; - let mode = get_mode(&matches).map_err(|e| USimpleError::new(1, e))?; + let mode = get_mode(matches.get_one::("mode")).map_err(|e| USimpleError::new(1, e))?; let file_name = matches .get_one::("name") @@ -220,8 +220,8 @@ pub fn uu_app() -> Command { ) } -fn get_mode(matches: &ArgMatches) -> Result { - match matches.get_one::("mode") { +fn get_mode(str_mode: Option<&String>) -> Result { + match str_mode { None => Ok(MODE_RW_UGO), Some(str_mode) => uucore::mode::parse_mode(str_mode) .map_err(|e| format!("invalid mode ({e})"))