Skip to content

Commit

Permalink
fix: some clippy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioRibera committed Sep 7, 2024
1 parent ac98896 commit 0a3c413
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions crates/sss_cli/src/shot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl ShotImpl {
}

pub fn all(&self) -> Result<RgbaImage, ImagenGeneration> {
return Ok(make_all_screens(
Ok(make_all_screens(
&self
.monitors
.iter()
Expand All @@ -96,7 +96,7 @@ impl ShotImpl {
.map_err(|e| ImagenGeneration::Custom(e.to_string()))
})
.collect::<Result<Vec<(_, _)>, ImagenGeneration>>()?,
));
))
}

pub fn capture_area(
Expand All @@ -118,9 +118,9 @@ impl ShotImpl {
.iter()
.find(|s| {
x >= s.x()
&& (x as i32) < s.x() + s.width() as i32
&& x < s.x() + s.width() as i32
&& y >= s.y()
&& (y as i32) < s.y() + s.height() as i32
&& y < s.y() + s.height() as i32
})
.ok_or(ImagenGeneration::Custom(format!(
"Screen not found in area: {x},{y} {w}x{h}"
Expand Down Expand Up @@ -161,8 +161,8 @@ impl ShotImpl {
}).ok_or(ImagenGeneration::Custom(format!(
"Screen not found in mouse position {mouse_position:?} or with id: {id:?} or with name: {name:?}"
)))?;
return screen
screen
.capture_image()
.map_err(|e| ImagenGeneration::Custom(e.to_string()));
.map_err(|e| ImagenGeneration::Custom(e.to_string()))
}
}
7 changes: 1 addition & 6 deletions crates/sss_code/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,7 @@ pub struct CodeConfig {
#[merge(strategy = overwrite_false)]
#[serde(skip)]
pub list_file_types: bool,
#[clap(
long,
short = 'L',
conflicts_with = "output",
help = "Lists themes"
)]
#[clap(long, short = 'L', conflicts_with = "output", help = "Lists themes")]
#[merge(strategy = overwrite_false)]
#[serde(skip)]
pub list_themes: bool,
Expand Down
2 changes: 1 addition & 1 deletion crates/sss_lib/src/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ impl FontCollection {

for glyph in glyphs {
glyph.draw(offset, |px, py, v| {
if v <= std::f32::EPSILON {
if v <= f32::EPSILON {
return;
}
let (x, y) = ((px + x as i32) as u32, (py + y as i32) as u32);
Expand Down
7 changes: 6 additions & 1 deletion crates/sss_lib/src/out.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ pub fn make_output(
"raw" => {
let mut stdout = std::io::stdout();
let encoder = PngEncoder::new(&mut stdout);
encoder.write_image(img, img.width(), img.height(), image::ColorType::Rgba8.into())?;
encoder.write_image(
img,
img.width(),
img.height(),
image::ColorType::Rgba8.into(),
)?;
}
_ => {
let format_img = str_to_format(fmt.unwrap_or("png"))?;
Expand Down

0 comments on commit 0a3c413

Please sign in to comment.