mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Remove needless use of dynamic dispatch
We return a plain function, all with matching signatures. No need for dynamic dispatch here.
This commit is contained in:
parent
cd9f5bdbaa
commit
6921394db2
1 changed files with 5 additions and 5 deletions
|
@ -667,15 +667,15 @@ fn path_sort(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr]) -> Op
|
|||
return retval;
|
||||
}
|
||||
|
||||
let keyfunc: &dyn Fn(&wstr) -> &wstr = match &opts.key {
|
||||
Some(k) if k == "basename" => &wbasename as _,
|
||||
Some(k) if k == "dirname" => &wdirname as _,
|
||||
let keyfunc: fn(&wstr) -> &wstr = match &opts.key {
|
||||
Some(k) if k == "basename" => wbasename,
|
||||
Some(k) if k == "dirname" => wdirname,
|
||||
Some(k) if k == "path" => {
|
||||
// Act as if --key hadn't been given.
|
||||
opts.key = None;
|
||||
&wbasename as _
|
||||
wbasename
|
||||
}
|
||||
None => &wbasename as _,
|
||||
None => wbasename,
|
||||
Some(k) => {
|
||||
path_error!(streams, "%ls: Invalid sort key '%ls'\n", args[0], k);
|
||||
return STATUS_INVALID_ARGS;
|
||||
|
|
Loading…
Reference in a new issue