From 20f9bb3b14785bda4d52448f66019823ca7377a5 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Tue, 13 Aug 2019 12:06:57 +0200 Subject: [PATCH 1/3] chore: setup clippy --- .circleci/config.yml | 20 +++++++++++++++++--- src/lib.rs | 5 +++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 91b30f3a8..430a9b4c2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,7 +13,7 @@ restore-workspace: &restore-workspace restore-cache: &restore-cache restore_cache: keys: - - cargo-v0-{{ checksum "rust-toolchain" }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}-{{ arch }} + - cargo-v1-{{ checksum "rust-toolchain" }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}-{{ arch }} - repo-source-{{ .Branch }}-{{ .Revision }} commands: @@ -53,10 +53,11 @@ jobs: command: cargo generate-lockfile - restore_cache: keys: - - cargo-v0-{{ checksum "rust-toolchain" }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}-{{ arch }} + - cargo-v1-{{ checksum "rust-toolchain" }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}-{{ arch }} - run: rustup install $(cat rust-toolchain) - run: rustup default $(cat rust-toolchain) - run: rustup component add --toolchain $(cat rust-toolchain) rustfmt + - run: rustup component add --toolchain $(cat rust-toolchain) clippy-preview - run: cargo update - run: cargo fetch - run: rustc +stable --version @@ -67,7 +68,7 @@ jobs: paths: - crate - save_cache: - key: cargo-v0-{{ checksum "rust-toolchain" }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}-{{ arch }} + key: cargo-v1-{{ checksum "rust-toolchain" }}-{{ checksum "Cargo.toml" }}-{{ checksum "Cargo.lock" }}-{{ arch }} paths: - "~/.cargo" - "~/.rustup" @@ -160,6 +161,15 @@ jobs: - run: ls -laR workspace - run: ci_scripts/ci_upload.sh workspace/py-docs workspace/wheelhouse + clippy: + executor: default + steps: + - *restore-workspace + - *restore-cache + - run: + name: Run cargo clippy + command: cargo clippy --all + workflows: version: 2.1 @@ -175,6 +185,10 @@ workflows: requires: - cargo_fetch + - clippy: + requires: + - cargo_fetch + # Linux Desktop 64bit - test_x86_64-unknown-linux-gnu: requires: diff --git a/src/lib.rs b/src/lib.rs index da16c8c4a..504770bb2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,8 @@ +#![deny(clippy::correctness)] +// TODO: make all of these errors, such that clippy actually passes. +#![warn(clippy::all, clippy::perf, clippy::not_unsafe_ptr_arg_deref)] +// This is nice, but for now just annoying. +#![allow(clippy::unreadable_literal)] #![feature(c_variadic, ptr_wrapping_offset_from, ptr_cast)] #[macro_use] From cfed5c914cb6f8b84532cbbc9d83ba6ab771c976 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Tue, 13 Aug 2019 12:07:08 +0200 Subject: [PATCH 2/3] chore: update rust nightly version --- rust-toolchain | 2 +- src/dc_array.rs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/rust-toolchain b/rust-toolchain index 3a7ebd2f9..e52479f6b 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2019-07-10 +nightly-2019-08-13 diff --git a/src/dc_array.rs b/src/dc_array.rs index 5ef73791c..92cb5bb5f 100644 --- a/src/dc_array.rs +++ b/src/dc_array.rs @@ -403,5 +403,4 @@ mod tests { } unsafe { dc_array_get_id(arr, 1000) }; } - } From 523141597ef97a4a862fd8f50cb263cabf9658c6 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Tue, 13 Aug 2019 12:20:47 +0200 Subject: [PATCH 3/3] chore: remove no longer needed features --- examples/repl/main.rs | 1 - src/lib.rs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/repl/main.rs b/examples/repl/main.rs index 92f36cb12..59648cf72 100644 --- a/examples/repl/main.rs +++ b/examples/repl/main.rs @@ -3,7 +3,6 @@ //! //! Usage: cargo run --example repl --release -- //! All further options can be set using the set-command (type ? for help). -#![feature(ptr_cast)] #[macro_use] extern crate deltachat; diff --git a/src/lib.rs b/src/lib.rs index 504770bb2..afbdad728 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,7 @@ #![warn(clippy::all, clippy::perf, clippy::not_unsafe_ptr_arg_deref)] // This is nice, but for now just annoying. #![allow(clippy::unreadable_literal)] -#![feature(c_variadic, ptr_wrapping_offset_from, ptr_cast)] +#![feature(ptr_wrapping_offset_from)] #[macro_use] extern crate failure_derive;