From ad45563f02130fa527019a6f0e82c639c9dc094c Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 1 May 2019 11:30:49 +0700 Subject: Enable clippy in RLS --- rls.toml | 1 + 1 file changed, 1 insertion(+) create mode 100644 rls.toml diff --git a/rls.toml b/rls.toml new file mode 100644 index 0000000..b94e1cb --- /dev/null +++ b/rls.toml @@ -0,0 +1 @@ +clippy_preference = "on" -- cgit v1.2.3 From 33f797aa38e3a62d050776473a7fdf1d1dc14a4e Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 1 May 2019 11:31:13 +0700 Subject: Add clippy to CI --- .travis.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 42c4136..9aa5d7c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,6 +39,9 @@ matrix: - BIN_NAME=miniserve - PROPER_NAME=miniserve-osx-x86_64 os: osx + - rust: nightly + env: + - CLIPPY=true before_install: - rustup self update @@ -47,10 +50,12 @@ before_install: install: # On Apple, the default target is already the right one. - if [[ -n $TARGET && $TARGET != "x86_64-apple-darwin" ]]; then rustup target add $TARGET; fi + - if [[ -n $CLIPPY ]]; then rustup component add clippy; fi script: # If this is a normal, non-deployment build... - - if [[ -z $TARGET ]]; then cargo build --verbose && RUST_BACKTRACE=1 cargo test; fi + - if [[ -z $TARGET && -z $CLIPPY ]]; then cargo build --verbose && RUST_BACKTRACE=1 cargo test; fi + - if [[ -n $CLIPPY ]]; then cargo clippy -- --deny clippy::all; fi - if [[ -n $TARGET ]]; then cargo build --verbose --release --target $TARGET; fi before_deploy: -- cgit v1.2.3 From 3da956c5af09c89e325928efb8dabe55d7fd6983 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 1 May 2019 14:00:30 +0700 Subject: Ignore clippy warnings --- src/auth.rs | 1 + src/listing.rs | 1 + src/main.rs | 1 + src/renderer.rs | 1 + 4 files changed, 4 insertions(+) diff --git a/src/auth.rs b/src/auth.rs index 8e6532b..040e81f 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -75,6 +75,7 @@ pub fn match_auth(basic_auth: BasicAuthParams, required_auth: &RequiredAuth) -> } /// Return `true` if hashing of `password` by `T` algorithm equals to `hash` +#[allow(clippy::ptr_arg)] pub fn compare_hash(password: String, hash: &Vec) -> bool { get_hash::(password) == *hash } diff --git a/src/listing.rs b/src/listing.rs index a030feb..87fd8a8 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -123,6 +123,7 @@ pub fn file_handler(req: &HttpRequest) -> Result( dir: &fs::Directory, req: &HttpRequest, diff --git a/src/main.rs b/src/main.rs index c1bb0aa..b7563eb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,6 +65,7 @@ fn main() { } } +#[allow(clippy::block_in_if_condition_stmt)] fn run() -> Result<(), ContextualError> { if cfg!(windows) && !Paint::enable_windows_ascii() { Paint::disable(); diff --git a/src/renderer.rs b/src/renderer.rs index b292e70..69224cf 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -9,6 +9,7 @@ use crate::listing::{Entry, SortingMethod, SortingOrder}; use crate::themes::ColorScheme; /// Renders the file listing +#[allow(clippy::too_many_arguments)] pub fn page( serve_path: &str, entries: Vec, -- cgit v1.2.3 From 9c7c5bcb02536cabd88db8c77c984098c82e9cd5 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 1 May 2019 14:33:12 +0700 Subject: Fix some Clippy lints --- src/auth.rs | 5 ++--- src/main.rs | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/auth.rs b/src/auth.rs index 040e81f..e526923 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -75,9 +75,8 @@ pub fn match_auth(basic_auth: BasicAuthParams, required_auth: &RequiredAuth) -> } /// Return `true` if hashing of `password` by `T` algorithm equals to `hash` -#[allow(clippy::ptr_arg)] -pub fn compare_hash(password: String, hash: &Vec) -> bool { - get_hash::(password) == *hash +pub fn compare_hash(password: String, hash: &[u8]) -> bool { + get_hash::(password) == hash } /// Get hash of a `text` diff --git a/src/main.rs b/src/main.rs index b7563eb..ea58fc6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,7 +65,6 @@ fn main() { } } -#[allow(clippy::block_in_if_condition_stmt)] fn run() -> Result<(), ContextualError> { if cfg!(windows) && !Paint::enable_windows_ascii() { Paint::disable(); @@ -84,12 +83,12 @@ fn run() -> Result<(), ContextualError> { && miniserve_config .path .symlink_metadata() - .map_err(|e| { + .map_err(|e| ContextualError::IOError( "Failed to retrieve symlink's metadata".to_string(), e, ) - })? + )? .file_type() .is_symlink() { -- cgit v1.2.3 From 19a2daa5e04ce8c835195fb2441276b26165b1b7 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 2 May 2019 20:30:44 +0700 Subject: Ignore nightly Clippy and enforce stable Clippy --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index b6a4b5e..39845cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,6 +17,8 @@ matrix: allow_failures: - rust: stable - rust: beta + - rust: nightly + env: CLIPPY=true include: - rust: stable - rust: beta @@ -43,6 +45,9 @@ matrix: - rust: nightly env: - CLIPPY=true + - rust: stable + env: + - CLIPPY=true before_install: - rustup self update -- cgit v1.2.3 From e48a12fc22b5a6c8057036b5c8ded59d17683da0 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 2 May 2019 22:18:39 +0700 Subject: Set env vars to same type (array) --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fdea92a..e63e51a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,8 @@ matrix: - rust: beta env: [] - rust: nightly - env: CLIPPY=true + env: + - CLIPPY=true include: - rust: stable env: [] -- cgit v1.2.3 From aba4f9b4a04f56e2de98b7b259c216178f6347ad Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 2 May 2019 22:23:41 +0700 Subject: Delete rls.toml --- rls.toml | 1 - 1 file changed, 1 deletion(-) delete mode 100644 rls.toml diff --git a/rls.toml b/rls.toml deleted file mode 100644 index b94e1cb..0000000 --- a/rls.toml +++ /dev/null @@ -1 +0,0 @@ -clippy_preference = "on" -- cgit v1.2.3 From b6c00c208cb740ab9e29cf043c970824a4326a15 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Thu, 2 May 2019 22:39:52 +0700 Subject: Use Clippy on a pinned Nightly version --- .travis.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index e63e51a..b436fb3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,9 +21,6 @@ matrix: env: [] - rust: beta env: [] - - rust: nightly - env: - - CLIPPY=true include: - rust: stable env: [] @@ -50,10 +47,7 @@ matrix: - BIN_NAME=miniserve - PROPER_NAME=miniserve-osx-x86_64 os: osx - - rust: nightly - env: - - CLIPPY=true - - rust: stable + - rust: nightly-2019-04-26 env: - CLIPPY=true -- cgit v1.2.3