mirror of
https://github.com/serde-rs/serde.git
synced 2025-10-02 15:25:38 +00:00
move to cargo clippy instead of using the clippy plugin (#733)
* move to cargo clippy instead of using the clippy plugin fixes #729 * non-exectable scripts must be run with `sh` * don't build serde in the clippy travis job * only run clippy tests if installing clippy succeeds * why is travis so picky? * no more serde_codegen * serde_test_suite_deps has no features * don't use empty loops, llvm optimizes them to undefined behaviour * abort the clippy job when clippy lints are triggered * use caches on travis to speed up builds * why are we even using `travis-cargo`? * need to reinstall clippy frequently due to nightly updates * command line tools are hard
This commit is contained in:
parent
74cf80989d
commit
368784949e
17
.travis.yml
17
.travis.yml
@ -1,5 +1,6 @@
|
|||||||
sudo: false
|
sudo: false
|
||||||
language: rust
|
language: rust
|
||||||
|
cache: cargo
|
||||||
|
|
||||||
# run builds for all the trains (and more)
|
# run builds for all the trains (and more)
|
||||||
rust:
|
rust:
|
||||||
@ -8,20 +9,16 @@ rust:
|
|||||||
- beta
|
- beta
|
||||||
- nightly
|
- nightly
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- rust: nightly
|
||||||
|
env: CLIPPY=true
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- pip install 'travis-cargo<0.2' --user
|
- pip install 'travis-cargo<0.2' --user
|
||||||
- export PATH=$HOME/.local/bin:$PATH
|
- export PATH=$HOME/.local/bin:$PATH
|
||||||
|
|
||||||
script:
|
script: sh travis.sh
|
||||||
- (cd serde && travis-cargo build)
|
|
||||||
- (cd serde && travis-cargo --only beta test)
|
|
||||||
- (cd serde && travis-cargo --only nightly test -- --features unstable-testing)
|
|
||||||
- (cd serde && travis-cargo build -- --no-default-features)
|
|
||||||
- (cd serde && travis-cargo --only nightly build -- --no-default-features --features alloc)
|
|
||||||
- (cd serde && travis-cargo --only nightly build -- --no-default-features --features collections)
|
|
||||||
- (cd test_suite && travis-cargo --only beta test)
|
|
||||||
- (cd test_suite/deps && travis-cargo --only nightly build && cd .. && travis-cargo --only nightly test -- --features unstable-testing)
|
|
||||||
- (cd test_suite/no_std && travis-cargo --only nightly build)
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
|
@ -22,10 +22,7 @@ std = []
|
|||||||
unstable = []
|
unstable = []
|
||||||
alloc = ["unstable"]
|
alloc = ["unstable"]
|
||||||
collections = ["alloc"]
|
collections = ["alloc"]
|
||||||
unstable-testing = ["clippy", "unstable", "std"]
|
unstable-testing = ["unstable", "std"]
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
clippy = { version = "0.*", optional = true }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
serde_derive = "0.9"
|
serde_derive = "0.9"
|
||||||
|
@ -64,9 +64,7 @@
|
|||||||
#![cfg_attr(feature = "unstable", feature(nonzero, inclusive_range, zero_one))]
|
#![cfg_attr(feature = "unstable", feature(nonzero, inclusive_range, zero_one))]
|
||||||
#![cfg_attr(feature = "alloc", feature(alloc))]
|
#![cfg_attr(feature = "alloc", feature(alloc))]
|
||||||
#![cfg_attr(feature = "collections", feature(collections, enumset))]
|
#![cfg_attr(feature = "collections", feature(collections, enumset))]
|
||||||
#![cfg_attr(feature = "clippy", feature(plugin))]
|
#![cfg_attr(feature = "cargo-clippy", allow(linkedlist, type_complexity, doc_markdown))]
|
||||||
#![cfg_attr(feature = "clippy", plugin(clippy))]
|
|
||||||
#![cfg_attr(feature = "clippy", allow(linkedlist, type_complexity, doc_markdown))]
|
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
|
|
||||||
#[cfg(feature = "collections")]
|
#[cfg(feature = "collections")]
|
||||||
|
@ -10,11 +10,7 @@ documentation = "https://docs.serde.rs/serde_codegen_internals/"
|
|||||||
keywords = ["serde", "serialization"]
|
keywords = ["serde", "serialization"]
|
||||||
include = ["Cargo.toml", "src/**/*.rs"]
|
include = ["Cargo.toml", "src/**/*.rs"]
|
||||||
|
|
||||||
[features]
|
|
||||||
unstable-testing = ["clippy"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clippy = { version = "0.*", optional = true }
|
|
||||||
syn = "0.11"
|
syn = "0.11"
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
#![cfg_attr(feature = "clippy", plugin(clippy))]
|
|
||||||
#![cfg_attr(feature = "clippy", feature(plugin))]
|
|
||||||
|
|
||||||
extern crate syn;
|
extern crate syn;
|
||||||
|
|
||||||
pub mod ast;
|
pub mod ast;
|
||||||
|
@ -12,7 +12,6 @@ include = ["Cargo.toml", "src/**/*.rs"]
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
unstable = []
|
unstable = []
|
||||||
unstable-testing = ["clippy", "serde_codegen_internals/unstable-testing"]
|
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
travis-ci = { repository = "serde-rs/serde" }
|
travis-ci = { repository = "serde-rs/serde" }
|
||||||
@ -22,7 +21,6 @@ name = "serde_derive"
|
|||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clippy = { version = "0.*", optional = true }
|
|
||||||
quote = "0.3.8"
|
quote = "0.3.8"
|
||||||
serde_codegen_internals = { version = "=0.12.0", default-features = false, path = "../serde_codegen_internals" }
|
serde_codegen_internals = { version = "=0.12.0", default-features = false, path = "../serde_codegen_internals" }
|
||||||
syn = { version = "0.11", features = ["aster", "visit"] }
|
syn = { version = "0.11", features = ["aster", "visit"] }
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#![cfg_attr(feature = "clippy", plugin(clippy))]
|
#![cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
||||||
#![cfg_attr(feature = "clippy", feature(plugin))]
|
#![cfg_attr(feature = "cargo-clippy", allow(used_underscore_binding))]
|
||||||
#![cfg_attr(feature = "clippy", allow(too_many_arguments))]
|
|
||||||
#![cfg_attr(feature = "clippy", allow(used_underscore_binding))]
|
|
||||||
|
|
||||||
// The `quote!` macro requires deep recursion.
|
// The `quote!` macro requires deep recursion.
|
||||||
#![recursion_limit = "192"]
|
#![recursion_limit = "192"]
|
||||||
|
@ -11,11 +11,7 @@ readme = "../README.md"
|
|||||||
keywords = ["serde", "serialization"]
|
keywords = ["serde", "serialization"]
|
||||||
include = ["Cargo.toml", "src/**/*.rs"]
|
include = ["Cargo.toml", "src/**/*.rs"]
|
||||||
|
|
||||||
[features]
|
|
||||||
unstable-testing = ["clippy"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clippy = { version = "0.*", optional = true }
|
|
||||||
serde = { version = "0.9", path = "../serde" }
|
serde = { version = "0.9", path = "../serde" }
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
#![cfg_attr(feature = "clippy", feature(plugin))]
|
|
||||||
#![cfg_attr(feature = "clippy", plugin(clippy))]
|
|
||||||
|
|
||||||
extern crate serde;
|
extern crate serde;
|
||||||
|
|
||||||
mod assert;
|
mod assert;
|
||||||
|
@ -13,11 +13,8 @@ publish = false
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
unstable-testing = [
|
unstable-testing = [
|
||||||
"clippy",
|
|
||||||
"compiletest_rs",
|
"compiletest_rs",
|
||||||
"serde/unstable-testing",
|
"serde/unstable-testing",
|
||||||
"serde_derive/unstable-testing",
|
|
||||||
"serde_test/unstable-testing",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
@ -28,7 +25,6 @@ serde_derive = { path = "../serde_derive" }
|
|||||||
serde_test = { path = "../serde_test" }
|
serde_test = { path = "../serde_test" }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clippy = { version = "0.*", optional = true }
|
|
||||||
compiletest_rs = { version = "0.2", optional = true }
|
compiletest_rs = { version = "0.2", optional = true }
|
||||||
|
|
||||||
[[test]]
|
[[test]]
|
||||||
|
@ -21,7 +21,9 @@ pub extern fn rust_eh_unwind_resume() {}
|
|||||||
pub extern fn rust_begin_panic(_msg: core::fmt::Arguments,
|
pub extern fn rust_begin_panic(_msg: core::fmt::Arguments,
|
||||||
_file: &'static str,
|
_file: &'static str,
|
||||||
_line: u32) -> ! {
|
_line: u32) -> ! {
|
||||||
loop {}
|
unsafe {
|
||||||
|
libc::abort()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
#![cfg_attr(feature = "clippy", feature(plugin))]
|
|
||||||
#![cfg_attr(feature = "clippy", plugin(clippy))]
|
|
||||||
|
|
||||||
#![cfg_attr(feature = "unstable-testing", feature(test, non_ascii_idents))]
|
#![cfg_attr(feature = "unstable-testing", feature(test, non_ascii_idents))]
|
||||||
|
|
||||||
#[cfg(feature = "unstable-testing")]
|
#[cfg(feature = "unstable-testing")]
|
||||||
|
24
travis.sh
Normal file
24
travis.sh
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -ev
|
||||||
|
if [ "${CLIPPY}" = "true" ]; then
|
||||||
|
if cargo install clippy -f; then
|
||||||
|
(cd serde && cargo clippy --features unstable-testing -- -Dclippy)
|
||||||
|
(cd serde_derive && cargo clippy --features unstable-testing -- -Dclippy)
|
||||||
|
(cd test_suite && cargo clippy --features unstable-testing -- -Dclippy)
|
||||||
|
(cd test_suite/deps && cargo clippy -- -Dclippy)
|
||||||
|
(cd test_suite/no_std && cargo clippy -- -Dclippy)
|
||||||
|
else
|
||||||
|
echo "could not compile clippy, ignoring clippy tests"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
(cd serde && travis-cargo build)
|
||||||
|
(cd serde && travis-cargo --only beta test)
|
||||||
|
(cd serde && travis-cargo --only nightly test -- --features unstable-testing)
|
||||||
|
(cd serde && travis-cargo build -- --no-default-features)
|
||||||
|
(cd serde && travis-cargo --only nightly build -- --no-default-features --features alloc)
|
||||||
|
(cd serde && travis-cargo --only nightly build -- --no-default-features --features collections)
|
||||||
|
(cd test_suite && travis-cargo --only beta test)
|
||||||
|
(cd test_suite/deps && travis-cargo --only nightly build)
|
||||||
|
(cd test_suite travis-cargo --only nightly test -- --features unstable-testing)
|
||||||
|
(cd test_suite/no_std && travis-cargo --only nightly build)
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user