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.
This commit is contained in:
Fries 2023-07-07 23:03:29 -07:00
parent 6e9bbe1d60
commit 74f3cd1cb4
2 changed files with 2 additions and 2 deletions

View file

@ -8,7 +8,7 @@ edition = "2021"
rust-version = "1.70"
[profile.dev]
lto = "thin"
lto = false
[profile.release]
lto = "thin"

View file

@ -33,7 +33,7 @@ pub fn previous_name(source_url: &String, names: &Vec<Site>) -> Option<String> {
pub fn next_name(source_url: &String, names: &Vec<Site>) -> Option<String> {
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),
},