clippy: fix lint related to iterator

warning: called `Iterator::last` on a `DoubleEndedIterator`; this will
needlessly iterate the entire iterator
   --> crates/notedeck/src/urls.rs:262:43
    |
262 |             if let Some(file_name) = path.last() {
    |                                           ^^^^^^ help: try: `next_back()`
    |

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-05-14 09:56:06 -07:00
parent c469a0ff22
commit 86d2a9e2e7

View File

@@ -258,8 +258,8 @@ fn is_mime_supported(mime: &mime_guess::Mime) -> bool {
fn url_has_supported_mime(url: &str) -> MimeHostedAtUrl {
if let Ok(url) = Url::parse(url) {
if let Some(path) = url.path_segments() {
if let Some(file_name) = path.last() {
if let Some(mut path) = url.path_segments() {
if let Some(file_name) = path.next_back() {
if let Some(ext) = std::path::Path::new(file_name)
.extension()
.and_then(|ext| ext.to_str())