Satisfy clippy

This commit is contained in:
Joscha 2024-08-25 20:30:48 +02:00
parent 4bdfc34706
commit c612bd35ad
4 changed files with 6 additions and 14 deletions

View file

@ -95,7 +95,7 @@ fn full_dijkstra(
page_idx: link.to, page_idx: link.to,
}; };
let mut target_page = data.page_mut(link.to); let target_page = data.page_mut(link.to);
if next.cost < target_page.data.cost { if next.cost < target_page.data.cost {
target_page.data.cost = next.cost; target_page.data.cost = next.cost;
target_page.data.prev_page_idx = page_idx; target_page.data.prev_page_idx = page_idx;

View file

@ -101,7 +101,7 @@ fn dijkstra(
page_idx: link.to, page_idx: link.to,
}; };
let mut target_page = data.page_mut(link.to); let target_page = data.page_mut(link.to);
if next.cost < target_page.data.cost { if next.cost < target_page.data.cost {
target_page.data.cost = next.cost; target_page.data.cost = next.cost;
target_page.data.prev_page_idx = page_idx; target_page.data.prev_page_idx = page_idx;

View file

@ -213,16 +213,8 @@ impl AdjacencyList<PageInfo, LinkInfo> {
assert!(self.pages.len() <= u32::MAX as usize, "pages len"); assert!(self.pages.len() <= u32::MAX as usize, "pages len");
assert!(self.links.len() <= u32::MAX as usize, "links len"); assert!(self.links.len() <= u32::MAX as usize, "links len");
for page in &self.pages { for page in &self.pages {
assert!(page.link_idx <= u32::MAX as u32, "page link_idx");
assert!(page.data.id <= u32::MAX as u32, "page id");
assert!(page.data.length <= u32::MAX as u32, "page length");
assert!(page.data.title.len() <= u8::MAX as usize, "page title len"); assert!(page.data.title.len() <= u8::MAX as usize, "page title len");
} }
for link in &self.links {
assert!(link.to <= u32::MAX as u32, "link to");
assert!(link.data.start <= u32::MAX as u32, "link start");
assert!(link.data.len <= u32::MAX as u32, "link end");
}
// Check that all links contain valid indices // Check that all links contain valid indices
let range = 0..self.pages.len() as u32; let range = 0..self.pages.len() as u32;

View file

@ -18,7 +18,7 @@ enum Command {
from: String, from: String,
to: String, to: String,
/// Flip start and end article. /// Flip start and end article.
#[clap(short, long)] #[arg(short, long)]
flip: bool, flip: bool,
}, },
/// Find the longest shortest path starting at an article. /// Find the longest shortest path starting at an article.