diff options
| author | Stuart Cook <Zalathar@users.noreply.github.com> | 2025-05-06 16:28:39 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-06 16:28:39 +1000 |
| commit | d5c09b4aa6107fef442abfb3940ede9a628b296b (patch) | |
| tree | ea337d6a496d665d2e24396d0a15db26a5e94d15 /library/std/src/sys | |
| parent | 5ca0053c794ec9c5a2c843785193bedeac53e4a8 (diff) | |
| parent | cbdd7134ff72aaf3679f4df2b2e4a0fe847edd06 (diff) | |
| download | rust-d5c09b4aa6107fef442abfb3940ede9a628b296b.tar.gz rust-d5c09b4aa6107fef442abfb3940ede9a628b296b.zip | |
Rollup merge of #139773 - thaliaarchi:vec-into-iter-last, r=workingjubilee
Implement `Iterator::last` for `vec::IntoIter` Avoid iterating everything when we have random access to the last element.
Diffstat (limited to 'library/std/src/sys')
| -rw-r--r-- | library/std/src/sys/args/common.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/std/src/sys/args/common.rs b/library/std/src/sys/args/common.rs index 303b373ccf9..e787105a05a 100644 --- a/library/std/src/sys/args/common.rs +++ b/library/std/src/sys/args/common.rs @@ -49,8 +49,8 @@ impl Iterator for Args { } #[inline] - fn last(mut self) -> Option<OsString> { - self.iter.next_back() + fn last(self) -> Option<OsString> { + self.iter.last() } #[inline] |
