Satisfy clippy
This commit is contained in:
parent
4bdfc34706
commit
c612bd35ad
4 changed files with 6 additions and 14 deletions
|
|
@ -95,7 +95,7 @@ fn full_dijkstra(
|
|||
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 {
|
||||
target_page.data.cost = next.cost;
|
||||
target_page.data.prev_page_idx = page_idx;
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ fn dijkstra(
|
|||
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 {
|
||||
target_page.data.cost = next.cost;
|
||||
target_page.data.prev_page_idx = page_idx;
|
||||
|
|
|
|||
|
|
@ -213,16 +213,8 @@ impl AdjacencyList<PageInfo, LinkInfo> {
|
|||
assert!(self.pages.len() <= u32::MAX as usize, "pages len");
|
||||
assert!(self.links.len() <= u32::MAX as usize, "links len");
|
||||
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");
|
||||
}
|
||||
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
|
||||
let range = 0..self.pages.len() as u32;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ enum Command {
|
|||
from: String,
|
||||
to: String,
|
||||
/// Flip start and end article.
|
||||
#[clap(short, long)]
|
||||
#[arg(short, long)]
|
||||
flip: bool,
|
||||
},
|
||||
/// Find the longest shortest path starting at an article.
|
||||
|
|
@ -26,7 +26,7 @@ enum Command {
|
|||
/// Print all page titles.
|
||||
ListPages,
|
||||
/// Construct wikipedia article graph for Leon.
|
||||
LeonWikiGraph { articles: PathBuf, language:String },
|
||||
LeonWikiGraph { articles: PathBuf, language: String },
|
||||
}
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
|
|
@ -52,8 +52,8 @@ fn main() -> io::Result<()> {
|
|||
commands::longest_shortest_path::run(&args.datafile, &from)
|
||||
}
|
||||
Command::ListPages => commands::list_pages::run(&args.datafile),
|
||||
Command::LeonWikiGraph { articles ,language} => {
|
||||
commands::leon_wiki_graph::run(&args.datafile, &articles,&language)
|
||||
Command::LeonWikiGraph { articles, language } => {
|
||||
commands::leon_wiki_graph::run(&args.datafile, &articles, &language)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue