From 7aacf10a296b0286685c4ff64d9d3bc8333bdbc2 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 9 Nov 2022 13:22:24 +0200 Subject: chore: remove unnecessary borrows Found by clippy. Sponsored-by: author --- src/directive/inline.rs | 2 +- src/page.rs | 2 +- src/site.rs | 2 +- src/util.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/directive/inline.rs b/src/directive/inline.rs index 78872b4..e6577b2 100644 --- a/src/directive/inline.rs +++ b/src/directive/inline.rs @@ -40,7 +40,7 @@ impl Inline { let matches: Vec = site .markdown_pages() .iter() - .filter(|page| pagespec.matches(&site, page.meta().path())) + .filter(|page| pagespec.matches(site, page.meta().path())) .map(|page| format!("* {}\n", Self::link(meta.path(), page.meta()))) .collect(); Ok(matches.join("")) diff --git a/src/page.rs b/src/page.rs index 2b4bd9f..fb2159d 100644 --- a/src/page.rs +++ b/src/page.rs @@ -24,7 +24,7 @@ impl WikitextPage { info!("input file: {}", name); let src = name.source_path(); - let data = std::fs::read(&src).map_err(|e| SiteError::FileRead(src.into(), e))?; + let data = std::fs::read(src).map_err(|e| SiteError::FileRead(src.into(), e))?; let wikitext = String::from_utf8(data).map_err(|e| SiteError::Utf8(src.into(), e))?; let mtime = get_mtime(src)?; diff --git a/src/site.rs b/src/site.rs index 6fa4625..0b03c85 100644 --- a/src/site.rs +++ b/src/site.rs @@ -131,7 +131,7 @@ impl Site { let mut names = vec![]; for path in srcdir.files().iter().filter(|x| filter.is_included(x)) { - let relative = path.strip_prefix(&self.builder.srcdir()).unwrap(); + let relative = path.strip_prefix(self.builder.srcdir()).unwrap(); let mtime = whatchanged.get(relative).copied().unwrap_or(UNIX_EPOCH); if Self::is_markdown(path) { names.push(self.builder.page(path, mtime)); diff --git a/src/util.rs b/src/util.rs index 064e556..bf78404 100644 --- a/src/util.rs +++ b/src/util.rs @@ -107,13 +107,13 @@ pub fn make_relative_link>(page: P, target: P) -> PathBuf { } pub fn make_path_relative_to(dir: &Path, path: &Path) -> PathBuf { - path.strip_prefix(&dir) + path.strip_prefix(dir) .unwrap_or_else(|_| panic!("remove prefix {} from {}", dir.display(), path.display())) .into() } pub fn make_path_absolute(path: &Path) -> PathBuf { - Path::new("/").join(&path) + Path::new("/").join(path) } fn timespec(time: SystemTime) -> Result { -- cgit v1.2.1