diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-11-09 13:22:24 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-11-09 13:22:42 +0200 |
commit | 7aacf10a296b0286685c4ff64d9d3bc8333bdbc2 (patch) | |
tree | 6ccf471a3d8e3cfa2717d17d911c6d6f93236ab6 | |
parent | 4b270f450b7a2ae1341ea22b8b373ba2cd8aa96c (diff) | |
download | riki-7aacf10a296b0286685c4ff64d9d3bc8333bdbc2.tar.gz |
chore: remove unnecessary borrows
Found by clippy.
Sponsored-by: author
-rw-r--r-- | src/directive/inline.rs | 2 | ||||
-rw-r--r-- | src/page.rs | 2 | ||||
-rw-r--r-- | src/site.rs | 2 | ||||
-rw-r--r-- | 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<String> = 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<P: AsRef<Path>>(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<timespec, SiteError> { |