Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Keats committed May 2, 2022
1 parent df9061b commit bdbe73e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion components/site/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ impl Site {
/// Add a page to the site
/// The `render` parameter is used in the serve command with --fast, when rebuilding a page.
pub fn add_page(&mut self, mut page: Page, render_md: bool) -> Result<()> {
for (taxa_name, _) in &page.meta.taxonomies {
for taxa_name in page.meta.taxonomies.keys() {
if !self.config.has_taxonomy(taxa_name, &page.lang) {
bail!(
"Page `{}` has taxonomy `{}` which is not defined in config.toml",
Expand Down
24 changes: 14 additions & 10 deletions components/site/src/link_checking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,22 @@ pub fn check_internal_links_with_anchors(site: &Site) -> Result<()> {
// as well as any other sring containing "_index." which is now referenced as
// unsupported page path in the docs.
if md_path.contains("_index.") {
let section = library.sections.get(&full_path).expect(&format!(
"Couldn't find section {} in check_internal_links_with_anchors from page {:?}",
md_path,
page.strip_prefix(&site.base_path).unwrap()
));
let section = library.sections.get(&full_path).unwrap_or_else(|| {
panic!(
"Couldn't find section {} in check_internal_links_with_anchors from page {:?}",
md_path,
page.strip_prefix(&site.base_path).unwrap()
)
});
!section.has_anchor(anchor)
} else {
let page = library.pages.get(&full_path).expect(&format!(
"Couldn't find page {} in check_internal_links_with_anchors from page {:?}",
md_path,
page.strip_prefix(&site.base_path).unwrap()
));
let page = library.pages.get(&full_path).unwrap_or_else(|| {
panic!(
"Couldn't find page {} in check_internal_links_with_anchors from page {:?}",
md_path,
page.strip_prefix(&site.base_path).unwrap()
)
});

!(page.has_anchor(anchor) || page.has_anchor_id(anchor))
}
Expand Down

0 comments on commit bdbe73e

Please sign in to comment.