Clippy
This commit is contained in:
parent
df9061b5a0
commit
bdbe73e23e
@ -397,7 +397,7 @@ impl Site {
|
|||||||
/// Add a page to the site
|
/// Add a page to the site
|
||||||
/// The `render` parameter is used in the serve command with --fast, when rebuilding a page.
|
/// 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<()> {
|
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) {
|
if !self.config.has_taxonomy(taxa_name, &page.lang) {
|
||||||
bail!(
|
bail!(
|
||||||
"Page `{}` has taxonomy `{}` which is not defined in config.toml",
|
"Page `{}` has taxonomy `{}` which is not defined in config.toml",
|
||||||
|
@ -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
|
// as well as any other sring containing "_index." which is now referenced as
|
||||||
// unsupported page path in the docs.
|
// unsupported page path in the docs.
|
||||||
if md_path.contains("_index.") {
|
if md_path.contains("_index.") {
|
||||||
let section = library.sections.get(&full_path).expect(&format!(
|
let section = library.sections.get(&full_path).unwrap_or_else(|| {
|
||||||
|
panic!(
|
||||||
"Couldn't find section {} in check_internal_links_with_anchors from page {:?}",
|
"Couldn't find section {} in check_internal_links_with_anchors from page {:?}",
|
||||||
md_path,
|
md_path,
|
||||||
page.strip_prefix(&site.base_path).unwrap()
|
page.strip_prefix(&site.base_path).unwrap()
|
||||||
));
|
)
|
||||||
|
});
|
||||||
!section.has_anchor(anchor)
|
!section.has_anchor(anchor)
|
||||||
} else {
|
} else {
|
||||||
let page = library.pages.get(&full_path).expect(&format!(
|
let page = library.pages.get(&full_path).unwrap_or_else(|| {
|
||||||
|
panic!(
|
||||||
"Couldn't find page {} in check_internal_links_with_anchors from page {:?}",
|
"Couldn't find page {} in check_internal_links_with_anchors from page {:?}",
|
||||||
md_path,
|
md_path,
|
||||||
page.strip_prefix(&site.base_path).unwrap()
|
page.strip_prefix(&site.base_path).unwrap()
|
||||||
));
|
)
|
||||||
|
});
|
||||||
|
|
||||||
!(page.has_anchor(anchor) || page.has_anchor_id(anchor))
|
!(page.has_anchor(anchor) || page.has_anchor_id(anchor))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user