diff --git a/po/de.po b/po/de.po index c3d05da8b..13a991314 100644 --- a/po/de.po +++ b/po/de.po @@ -708,10 +708,6 @@ msgstr "%ls: Erwartete numerischen Wert" msgid "%ls: fish was not built with embedded files" msgstr "" -#, c-format -msgid "%ls: function name required" -msgstr "%ls: Brauche Funktionsnamen" - #, c-format msgid "%ls: given %d indexes but %d values\n" msgstr "" diff --git a/po/en.po b/po/en.po index 6e167d8b5..0e176bab9 100644 --- a/po/en.po +++ b/po/en.po @@ -706,10 +706,6 @@ msgstr "%ls: expected a numeric value" msgid "%ls: fish was not built with embedded files" msgstr "" -#, c-format -msgid "%ls: function name required" -msgstr "" - #, c-format msgid "%ls: given %d indexes but %d values\n" msgstr "" diff --git a/po/fr.po b/po/fr.po index f7e0fbbf4..1d8c1856d 100644 --- a/po/fr.po +++ b/po/fr.po @@ -807,10 +807,6 @@ msgstr "%ls : valeur numérique attendue" msgid "%ls: fish was not built with embedded files" msgstr "" -#, c-format -msgid "%ls: function name required" -msgstr "" - #, c-format msgid "%ls: given %d indexes but %d values\n" msgstr "" diff --git a/po/pl.po b/po/pl.po index 604e85d3e..bca34e8dc 100644 --- a/po/pl.po +++ b/po/pl.po @@ -702,10 +702,6 @@ msgstr "%ls: oczekiwano wartości liczbowej" msgid "%ls: fish was not built with embedded files" msgstr "" -#, c-format -msgid "%ls: function name required" -msgstr "" - #, c-format msgid "%ls: given %d indexes but %d values\n" msgstr "" diff --git a/po/pt_BR.po b/po/pt_BR.po index b7e93904c..3b40793d8 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -707,10 +707,6 @@ msgstr "%ls: esperava valor numérico" msgid "%ls: fish was not built with embedded files" msgstr "" -#, c-format -msgid "%ls: function name required" -msgstr "" - #, c-format msgid "%ls: given %d indexes but %d values\n" msgstr "" diff --git a/po/sv.po b/po/sv.po index ddff174b4..96207d5c6 100644 --- a/po/sv.po +++ b/po/sv.po @@ -703,10 +703,6 @@ msgstr "" msgid "%ls: fish was not built with embedded files" msgstr "" -#, c-format -msgid "%ls: function name required" -msgstr "" - #, c-format msgid "%ls: given %d indexes but %d values\n" msgstr "" diff --git a/po/zh_CN.po b/po/zh_CN.po index 2629b8c72..f3693df16 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -700,10 +700,6 @@ msgstr "%ls: 预期数字类型值" msgid "%ls: fish was not built with embedded files" msgstr "" -#, c-format -msgid "%ls: function name required" -msgstr "%ls: 函数名称是必须的" - #, c-format msgid "%ls: given %d indexes but %d values\n" msgstr "%ls: 给定的 %d 索引但 %d 值\n" diff --git a/src/builtins/function.rs b/src/builtins/function.rs index fcbf55e4a..687406f7d 100644 --- a/src/builtins/function.rs +++ b/src/builtins/function.rs @@ -243,20 +243,7 @@ fn parse_cmd_opts( STATUS_CMD_OK } -fn validate_function_name( - argv: &mut [&wstr], - function_name: &mut WString, - cmd: &wstr, - streams: &mut IoStreams, -) -> c_int { - if argv.len() < 2 { - // This is currently impossible but let's be paranoid. - streams - .err - .append(wgettext_fmt!("%ls: function name required", cmd)); - return STATUS_INVALID_ARGS; - } - *function_name = argv[1].to_owned(); +fn validate_function_name(function_name: &wstr, cmd: &wstr, streams: &mut IoStreams) -> c_int { if !valid_func_name(function_name) { streams.err.append(wgettext_fmt!( "%ls: %ls: invalid function name", @@ -294,8 +281,8 @@ pub fn function( let cmd = argv[0]; // A valid function name has to be the first argument. - let mut function_name = WString::new(); - let mut retval = validate_function_name(argv, &mut function_name, cmd, streams); + let function_name = argv[1].to_owned(); + let mut retval = validate_function_name(&function_name, cmd, streams); if retval != STATUS_CMD_OK { return retval; }