Enable and fix warnings and lints
This commit is contained in:
parent
51e3fed4f6
commit
2a174de7bd
2 changed files with 29 additions and 7 deletions
11
src/lib.rs
11
src/lib.rs
|
|
@ -1 +1,12 @@
|
||||||
|
#![forbid(unsafe_code)]
|
||||||
|
// Rustc lint groups
|
||||||
|
#![warn(future_incompatible)]
|
||||||
|
#![warn(rust_2018_idioms)]
|
||||||
|
#![warn(unused)]
|
||||||
|
// Rustc lints
|
||||||
|
#![warn(noop_method_call)]
|
||||||
|
#![warn(single_use_lifetimes)]
|
||||||
|
// Clippy lints
|
||||||
|
#![warn(clippy::use_self)]
|
||||||
|
|
||||||
pub mod bw;
|
pub mod bw;
|
||||||
|
|
|
||||||
25
src/main.rs
25
src/main.rs
|
|
@ -1,3 +1,14 @@
|
||||||
|
#![forbid(unsafe_code)]
|
||||||
|
// Rustc lint groups
|
||||||
|
#![warn(future_incompatible)]
|
||||||
|
#![warn(rust_2018_idioms)]
|
||||||
|
#![warn(unused)]
|
||||||
|
// Rustc lints
|
||||||
|
#![warn(noop_method_call)]
|
||||||
|
#![warn(single_use_lifetimes)]
|
||||||
|
// Clippy lints
|
||||||
|
#![warn(clippy::use_self)]
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
io::{Cursor, Read, Write},
|
io::{Cursor, Read, Write},
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
|
|
@ -20,12 +31,12 @@ enum BwMethod {
|
||||||
impl From<BwMethod> for bw::Method {
|
impl From<BwMethod> for bw::Method {
|
||||||
fn from(value: BwMethod) -> Self {
|
fn from(value: BwMethod) -> Self {
|
||||||
match value {
|
match value {
|
||||||
BwMethod::SrgbAverage => bw::Method::SrgbAverage,
|
BwMethod::SrgbAverage => Self::SrgbAverage,
|
||||||
BwMethod::LinSrgbAverage => bw::Method::LinSrgbAverage,
|
BwMethod::LinSrgbAverage => Self::LinSrgbAverage,
|
||||||
BwMethod::Hsl => bw::Method::Hsl,
|
BwMethod::Hsl => Self::Hsl,
|
||||||
BwMethod::Hsv => bw::Method::Hsv,
|
BwMethod::Hsv => Self::Hsv,
|
||||||
BwMethod::Cielab => bw::Method::Cielab,
|
BwMethod::Cielab => Self::Cielab,
|
||||||
BwMethod::Oklab => bw::Method::Oklab,
|
BwMethod::Oklab => Self::Oklab,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -52,7 +63,7 @@ enum Cmd {
|
||||||
impl Cmd {
|
impl Cmd {
|
||||||
fn run(self, image: RgbaImage) -> RgbaImage {
|
fn run(self, image: RgbaImage) -> RgbaImage {
|
||||||
match self {
|
match self {
|
||||||
Cmd::Bw(cmd) => cmd.run(image),
|
Self::Bw(cmd) => cmd.run(image),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue