refactor: remove unnecessary copied() for Utf32Str reference

This commit is contained in:
Himadri Bhattacharjee 2024-12-02 17:12:30 +05:30 committed by Fabian Boehm
parent b2e6609367
commit d124c31958

View file

@ -86,12 +86,8 @@ pub fn source(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr]) -> O
// Construct argv from our null-terminated list.
// This is slightly subtle. If this is a bare `source` with no args then `argv + optind` already
// points to the end of argv. Otherwise we want to skip the file name to get to the args if any.
let mut argv_list: Vec<WString> = vec![];
let remaining_args = &args[optind + if argc == optind { 0 } else { 1 }..];
#[allow(clippy::unnecessary_to_owned)]
for arg in remaining_args.iter().copied() {
argv_list.push(arg.to_owned());
}
let argv_list = remaining_args.iter().map(|&arg| arg.to_owned()).collect();
parser.vars().set_argv(argv_list);
let mut retval = reader_read(parser, fd, streams.io_chain);