Skip to content

Commit

Permalink
fix: make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Aloxaf committed Oct 13, 2022
1 parent e0fd52b commit a906fd2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use syntect::dumps;
use syntect::highlighting::ThemeSet;
use syntect::parsing::SyntaxSet;

const DEFAULT_SYNTAXSET: &'static [u8] = include_bytes!("../assets/syntaxes.bin");
const DEFAULT_THEMESET: &'static [u8] = include_bytes!("../assets/themes.bin");
const DEFAULT_SYNTAXSET: &[u8] = include_bytes!("../assets/syntaxes.bin");
const DEFAULT_THEMESET: &[u8] = include_bytes!("../assets/themes.bin");

pub struct HighlightingAssets {
pub syntax_set: SyntaxSet,
Expand Down
8 changes: 4 additions & 4 deletions src/bin/silicon/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn get_args_from_config_file() -> Vec<OsString> {
.split('\n')
.map(|line| line.trim())
.filter(|line| !line.starts_with('#') && !line.is_empty())
.map(|line| shell_words::split(line))
.map(shell_words::split)
.collect::<Result<Vec<_>, _>>()
.ok()
})
Expand All @@ -39,8 +39,8 @@ pub fn get_args_from_config_file() -> Vec<OsString> {
}

fn parse_str_color(s: &str) -> Result<Rgba<u8>, Error> {
Ok(s.to_rgba()
.map_err(|_| format_err!("Invalid color: `{}`", s))?)
s.to_rgba()
.map_err(|_| format_err!("Invalid color: `{}`", s))
}

fn parse_font_str(s: &str) -> Vec<(String, f32)> {
Expand Down Expand Up @@ -301,7 +301,7 @@ impl Config {
if let (Ok(home_dir), true) = (std::env::var("HOME"), need_expand) {
self.output
.as_ref()
.map(|p| p.to_string_lossy().replacen("~", &home_dir, 1).into())
.map(|p| p.to_string_lossy().replacen('~', &home_dir, 1).into())
} else {
self.output.clone()
}
Expand Down
2 changes: 1 addition & 1 deletion src/bin/silicon/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn dump_image_to_clipboard(image: &DynamicImage) -> Result<(), Error> {
let mut temp = tempfile::NamedTempFile::new()?;
image.write_to(&mut temp, ImageOutputFormat::Png)?;
Command::new("xclip")
.args(&[
.args([
"-sel",
"clip",
"-t",
Expand Down
1 change: 1 addition & 0 deletions src/blur.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct SharedMutPtr(*mut [[u8; 4]]);
unsafe impl Sync for SharedMutPtr {}

impl SharedMutPtr {
#[allow(clippy::mut_from_ref)]
unsafe fn get(&self) -> &mut [[u8; 4]] {
&mut *self.0
}
Expand Down
8 changes: 4 additions & 4 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,16 @@ pub(crate) fn round_corner(image: &mut DynamicImage, radius: u32) {
foreground,
);

let part = crop_imm(&mut circle, 0, 0, radius, radius);
let part = crop_imm(&circle, 0, 0, radius, radius);
image.copy_from(&*part, 0, 0).unwrap();

let part = crop_imm(&mut circle, radius + 1, 0, radius, radius);
let part = crop_imm(&circle, radius + 1, 0, radius, radius);
image.copy_from(&*part, width - radius, 0).unwrap();

let part = crop_imm(&mut circle, 0, radius + 1, radius, radius);
let part = crop_imm(&circle, 0, radius + 1, radius, radius);
image.copy_from(&*part, 0, height - radius).unwrap();

let part = crop_imm(&mut circle, radius + 1, radius + 1, radius, radius);
let part = crop_imm(&circle, radius + 1, radius + 1, radius, radius);
image
.copy_from(&*part, width - radius, height - radius)
.unwrap();
Expand Down

0 comments on commit a906fd2

Please sign in to comment.