Merge pull request #2376 from ehuss/clippy-fixes
Apply a few minor clippy fixes
This commit is contained in:
commit
83444650a3
5 changed files with 12 additions and 18 deletions
|
|
@ -330,7 +330,7 @@ impl MDBook {
|
|||
|
||||
let mut cmd = Command::new("rustdoc");
|
||||
cmd.current_dir(temp_dir.path())
|
||||
.arg(&chapter_path)
|
||||
.arg(chapter_path)
|
||||
.arg("--test")
|
||||
.args(&library_args);
|
||||
|
||||
|
|
@ -349,7 +349,7 @@ impl MDBook {
|
|||
}
|
||||
|
||||
if color_output {
|
||||
cmd.args(&["--color", "always"]);
|
||||
cmd.args(["--color", "always"]);
|
||||
}
|
||||
|
||||
debug!("running {:?}", cmd);
|
||||
|
|
|
|||
|
|
@ -583,11 +583,13 @@ fn get_last_link(links: &mut [SummaryItem]) -> Result<(usize, &mut Link)> {
|
|||
.iter_mut()
|
||||
.enumerate()
|
||||
.filter_map(|(i, item)| item.maybe_link_mut().map(|l| (i, l)))
|
||||
.rev()
|
||||
.next()
|
||||
.ok_or_else(||
|
||||
anyhow::anyhow!("Unable to get last link because the list of SummaryItems doesn't contain any Links")
|
||||
.next_back()
|
||||
.ok_or_else(|| {
|
||||
anyhow::anyhow!(
|
||||
"Unable to get last link because the list of SummaryItems \
|
||||
doesn't contain any Links"
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
/// Removes the styling from a list of Markdown events and returns just the
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ fn filter_ignored_files(ignore: Gitignore, paths: &[PathBuf]) -> Vec<PathBuf> {
|
|||
.iter()
|
||||
.filter(|path| {
|
||||
let relative_path =
|
||||
diff_paths(&path, &ignore_root).expect("One of the paths should be an absolute");
|
||||
diff_paths(path, &ignore_root).expect("One of the paths should be an absolute");
|
||||
!ignore
|
||||
.matched_path_or_any_parents(&relative_path, relative_path.is_dir())
|
||||
.is_ignore()
|
||||
|
|
|
|||
|
|
@ -694,21 +694,13 @@ impl Default for Playground {
|
|||
}
|
||||
|
||||
/// Configuration for tweaking how the HTML renderer handles code blocks.
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(default, rename_all = "kebab-case")]
|
||||
pub struct Code {
|
||||
/// A prefix string to hide lines per language (one or more chars).
|
||||
pub hidelines: HashMap<String, String>,
|
||||
}
|
||||
|
||||
impl Default for Code {
|
||||
fn default() -> Code {
|
||||
Code {
|
||||
hidelines: HashMap::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Configuration of the search functionality of the HTML renderer.
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(default, rename_all = "kebab-case")]
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ impl HelperDef for RenderToc {
|
|||
|
||||
for item in chapters {
|
||||
// Spacer
|
||||
if item.get("spacer").is_some() {
|
||||
if item.contains_key("spacer") {
|
||||
out.write("<li class=\"spacer\"></li>")?;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -114,7 +114,7 @@ impl HelperDef for RenderToc {
|
|||
write_li_open_tag(out, is_expanded, false)?;
|
||||
}
|
||||
Ordering::Equal => {
|
||||
write_li_open_tag(out, is_expanded, item.get("section").is_none())?;
|
||||
write_li_open_tag(out, is_expanded, !item.contains_key("section"))?;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue