Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Mar 20, 2024
1 parent 0a744cf commit 68c1f99
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct Compiler {

impl Compiler {
pub fn set_up(root: impl AsRef<Path>, reference: Reference) -> Result<Self, Error> {
const CARGO_TOML: &'static str = include_str!("compiler/Cargo.toml.template");
const CARGO_TOML: &str = include_str!("compiler/Cargo.toml.template");

let build = root.as_ref().join("target").join("icebergs");
fs::create_dir_all(&build)?;
Expand Down Expand Up @@ -63,7 +63,7 @@ impl Compiler {
.join("\n");

let hash = Hash(
Sha256::digest(&format!("{code}{}", self.hash))
Sha256::digest(format!("{code}{}", self.hash))
.into_iter()
.map(|byte| format!("{byte:x}"))
.join(""),
Expand Down Expand Up @@ -106,18 +106,18 @@ impl Compiler {
}

pub fn retain(&self, icebergs: &BTreeSet<Iceberg>) -> Result<(), Error> {
clean_dir(&self.artifacts, &icebergs)?;
clean_dir(&self.artifacts, icebergs)?;

Ok(())
}

pub fn release<'a>(
pub fn release(
&self,
icebergs: &BTreeSet<Iceberg>,
target: impl AsRef<Path>,
) -> Result<(), Error> {
let target = target.as_ref();
clean_dir(target, &icebergs)?;
clean_dir(target, icebergs)?;

for iceberg in icebergs {
let output = target.join(iceberg.hash.as_str());
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fn process_chapter(
Event::Start(Tag::CodeBlock(CodeBlockKind::Fenced(label)))
if label.starts_with("rust")
&& label
.split(",")
.split(',')
.any(|modifier| modifier.starts_with("iced")) =>
{
in_iced_code = true;
Expand Down Expand Up @@ -104,7 +104,7 @@ fn process_chapter(
Some(
modifier
.strip_prefix("iced(")?
.strip_suffix(")")?
.strip_suffix(')')?
.split_once("height=")?
.1
.to_string(),
Expand All @@ -131,10 +131,10 @@ fn process_chapter(
events.push(Event::InlineHtml(compiler::Iceberg::LIBRARY.into()));
}

if let Some(iceberg) = icebergs.last().map(Option::as_ref).flatten() {
if let Some(iceberg) = icebergs.last().and_then(Option::as_ref) {
events.push(Event::InlineHtml(
iceberg
.embed(heights.last().map(Option::as_deref).flatten())
.embed(heights.last().and_then(Option::as_deref))
.into(),
));
}
Expand Down

0 comments on commit 68c1f99

Please sign in to comment.