Skip to content

Commit 36c40b7

Browse files
committed
mknod: pass a string instead of matches
1 parent 2e982e3 commit 36c40b7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/uu/mknod/src/mknod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ fn _mknod(file_name: &str, config: Config) -> i32 {
101101
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
102102
let matches = uu_app().try_get_matches_from(args)?;
103103

104-
let mode = get_mode(&matches).map_err(|e| USimpleError::new(1, e))?;
104+
let mode = get_mode(matches.get_one::<String>("mode")).map_err(|e| USimpleError::new(1, e))?;
105105

106106
let file_name = matches
107107
.get_one::<String>("name")
@@ -219,8 +219,8 @@ pub fn uu_app() -> Command {
219219
)
220220
}
221221

222-
fn get_mode(matches: &ArgMatches) -> Result<mode_t, String> {
223-
match matches.get_one::<String>("mode") {
222+
fn get_mode(str_mode: Option<&String>) -> Result<mode_t, String> {
223+
match str_mode {
224224
None => Ok(MODE_RW_UGO),
225225
Some(str_mode) => uucore::mode::parse_mode(str_mode)
226226
.map_err(|e| format!("invalid mode ({e})"))

0 commit comments

Comments
 (0)