Skip to content

Commit

Permalink
Some clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Keats committed Apr 7, 2021
1 parent 0afd31d commit fc808f2
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion components/config/src/config/markup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl Markdown {
pub fn construct_external_link_tag(&self, url: &str, title: &str) -> String {
let mut rel_opts = Vec::new();
let mut target = "".to_owned();
let title = if title == "" { "".to_owned() } else { format!("title=\"{}\" ", title) };
let title = if title.is_empty() { "".to_owned() } else { format!("title=\"{}\" ", title) };

if self.external_links_target_blank {
// Security risk otherwise
Expand Down
2 changes: 0 additions & 2 deletions components/front_matter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ use serde_derive::{Deserialize, Serialize};

use errors::{bail, Error, Result};
use regex::Regex;
use serde_yaml;
use std::path::Path;
use toml;

mod page;
mod section;
Expand Down
2 changes: 1 addition & 1 deletion components/front_matter/src/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl PageFrontMatter {
}

if let Some(ref path) = f.path {
if path == "" {
if path.is_empty() {
bail!("`path` can't be empty if present")
}
}
Expand Down
3 changes: 1 addition & 2 deletions components/imageproc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,7 @@ impl ImageOp {
Some(q) => encoder.encode(q as f32 / 100.),
None => encoder.encode_lossless(),
};
let mut bytes = memory.as_bytes();
f.write_all(&mut bytes)?;
f.write_all(&memory.as_bytes())?;
}
}

Expand Down
4 changes: 2 additions & 2 deletions components/library/src/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl Library {
let file_path = section.file.path.clone();
let rel_path = section.path.clone();

let mut entries = vec![rel_path.clone()];
let mut entries = vec![rel_path];
entries.extend(section.meta.aliases.iter().map(|a| a.clone()).collect::<Vec<String>>());
self.insert_reverse_aliases(entries, &section.file.relative);

Expand All @@ -98,7 +98,7 @@ impl Library {
let file_path = page.file.path.clone();
let rel_path = page.path.clone();

let mut entries = vec![rel_path.clone()];
let mut entries = vec![rel_path];
entries.extend(page.meta.aliases.iter().map(|a| a.clone()).collect::<Vec<String>>());
self.insert_reverse_aliases(entries, &page.file.relative);

Expand Down
3 changes: 1 addition & 2 deletions src/cmd/init.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::fs::{canonicalize, create_dir};
use std::path::Path;
use std::path::PathBuf;

use errors::{bail, Result};
use utils::fs::create_file;
Expand Down Expand Up @@ -68,7 +67,7 @@ pub fn is_directory_quasi_empty(path: &Path) -> Result<bool> {
}

// Remove the unc part of a windows path
fn strip_unc(path: &PathBuf) -> String {
fn strip_unc(path: &Path) -> String {
let path_to_refine = path.to_str().unwrap();
path_to_refine.trim_start_matches(LOCAL_UNC).to_string()
}
Expand Down

0 comments on commit fc808f2

Please sign in to comment.