Fix clippy build
Diff
src/git.rs | 16 +++++++---------
src/main.rs | 4 ++--
src/database/indexer.rs | 4 ++--
src/methods/filters.rs | 2 +-
src/database/schema/commit.rs | 2 +-
src/database/schema/tag.rs | 2 +-
src/methods/repo/mod.rs | 2 +-
src/methods/repo/tree.rs | 4 ++--
8 files changed, 15 insertions(+), 21 deletions(-)
@@ -225,25 +225,19 @@
.context("Couldn't get the tree that the HEAD refers to")?;
for name in README_FILES {
let tree_entry = if let Some(file) = tree.get_name(name) {
file
} else {
let Some(tree_entry) = tree.get_name(name) else {
continue;
};
let blob = if let Some(blob) = tree_entry
let Some(blob) = tree_entry
.to_object(&repo)
.ok()
.and_then(|v| v.into_blob().ok())
{
blob
} else {
else {
continue;
};
let content = if let Ok(content) = std::str::from_utf8(blob.content()) {
content
} else {
let Ok(content) = std::str::from_utf8(blob.content()) else {
continue;
};
@@ -508,7 +502,7 @@
let email = diff
.format_email(1, 1, commit, None)
.context("Couldn't build diff for commit")?;
diff_plain.extend_from_slice(&*email);
diff_plain.extend_from_slice(&email);
let diff_stats = diff
.stats()?
@@ -79,7 +79,7 @@
let theme = bat_assets.get_theme("GitHub");
let css = syntect::html::css_for_theme_with_class_style(theme, ClassStyle::Spaced).unwrap();
let css = Box::leak(
format!(r#"@media (prefers-color-scheme: light){{{}}}"#, css)
format!(r#"@media (prefers-color-scheme: light){{{css}}}"#)
.into_boxed_str()
.into_boxed_bytes(),
);
@@ -88,7 +88,7 @@
let dark_css =
syntect::html::css_for_theme_with_class_style(dark_theme, ClassStyle::Spaced).unwrap();
let dark_css = Box::leak(
format!(r#"@media (prefers-color-scheme: dark){{{}}}"#, dark_css)
format!(r#"@media (prefers-color-scheme: dark){{{dark_css}}}"#)
.into_boxed_str()
.into_boxed_bytes(),
);
@@ -44,7 +44,7 @@
let description = std::fs::read(repository.join("description")).unwrap_or_default();
let description = Some(String::from_utf8_lossy(&description)).filter(|v| !v.is_empty());
let git_repository = git2::Repository::open(scan_path.join(&relative)).unwrap();
let git_repository = git2::Repository::open(scan_path.join(relative)).unwrap();
Repository {
id,
@@ -131,7 +131,7 @@
for to_remove in (i + 1)..(i + 100) {
commit_tree.remove(&to_remove.to_be_bytes()).unwrap();
commit_tree.remove(to_remove.to_be_bytes()).unwrap();
}
}
}
@@ -17,7 +17,7 @@
}
pub fn md5(s: &str) -> Result<String, askama::Error> {
Ok(hex::encode(&md5::compute(s).0))
Ok(hex::encode(md5::compute(s).0))
}
#[allow(dead_code)]
@@ -40,7 +40,7 @@
pub fn insert(&self, batch: &CommitTree, id: usize) {
batch
.insert(&id.to_be_bytes(), bincode::serialize(self).unwrap())
.insert(id.to_be_bytes(), bincode::serialize(self).unwrap())
.unwrap();
}
}
@@ -22,7 +22,7 @@
pub fn insert(&self, batch: &TagTree, name: &str) {
batch
.insert(&name.as_bytes(), bincode::serialize(self).unwrap())
.insert(name.as_bytes(), bincode::serialize(self).unwrap())
.unwrap();
}
}
@@ -162,7 +162,7 @@
impl From<Arc<anyhow::Error>> for Error {
fn from(e: Arc<anyhow::Error>) -> Self {
Self(anyhow::Error::msg(format!("{:?}", e)))
Self(anyhow::Error::msg(format!("{e:?}")))
}
}
@@ -29,12 +29,12 @@
let mut prefix = "?";
if let Some(id) = self.id.as_deref() {
write!(f, "{}id={}", prefix, id)?;
write!(f, "{prefix}id={id}")?;
prefix = "&";
}
if let Some(branch) = self.branch.as_deref() {
write!(f, "{}h={}", prefix, branch)?;
write!(f, "{prefix}h={branch}")?;
}
Ok(())