From 74f3cd1cb42af4ecd1e77ed959b1f3ac291a37ae Mon Sep 17 00:00:00 2001 From: Fries Date: Fri, 7 Jul 2023 23:03:29 -0700 Subject: [PATCH] fix a bug with the next_name function looks like i used the previous_name logic for element of the vector i used which is wrong. --- Cargo.toml | 2 +- src/links.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f3c97d9..8bf10b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" rust-version = "1.70" [profile.dev] -lto = "thin" +lto = false [profile.release] lto = "thin" diff --git a/src/links.rs b/src/links.rs index d28f8f0..de60dd5 100644 --- a/src/links.rs +++ b/src/links.rs @@ -33,7 +33,7 @@ pub fn previous_name(source_url: &String, names: &Vec) -> Option { pub fn next_name(source_url: &String, names: &Vec) -> Option { match names.iter().position(|r| &r.url == source_url) { - Some(index) if index == names.len() - 1 => match &names[names.len() - 1].name { + Some(index) if index == names.len() - 1 => match &names[0].name { Some(name) => Some(name.clone()), None => next_url(source_url, names), },