Add clippy and rustfmt checks (#58)
This commit is contained in:
parent
b15ce2b24b
commit
9f87c73a51
|
@ -27,10 +27,14 @@ before_script:
|
|||
export PATH=$HOME/.local/bin:$PATH
|
||||
# Remove rust-toolchain override for tests
|
||||
- rm rust-toolchain
|
||||
- rustup component add rustfmt
|
||||
- rustup component add clippy || cargo install --git https://github.com/rust-lang/rust-clippy/ --force clippy
|
||||
script:
|
||||
- cargo fmt -- --check
|
||||
- cargo clippy "${CARGO_FLAGS}" -- -D warnings
|
||||
- |
|
||||
travis-cargo build -- "${CARGO_FLAGS}" &&
|
||||
travis-cargo test -- "${CARGO_FLAGS}" &&
|
||||
cargo build "${CARGO_FLAGS}" &&
|
||||
cargo test "${CARGO_FLAGS}" &&
|
||||
travis-cargo --only nightly doc -- --no-deps "${CARGO_FLAGS}"
|
||||
after_success:
|
||||
- test $CARGO_FLAGS = "--all-features" && travis-cargo --only nightly doc-upload
|
||||
|
|
|
@ -58,7 +58,7 @@ fn on_response_wrapper(
|
|||
|
||||
let result = request.local_cache(|| unreachable!("This should not be executed so late"));
|
||||
|
||||
if let &CorsValidation::Failure = result {
|
||||
if let CorsValidation::Failure = *result {
|
||||
// Nothing else for us to do
|
||||
return Ok(());
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ mod tests {
|
|||
assert!(failed_origins.is_empty());
|
||||
|
||||
CorsOptions {
|
||||
allowed_origins: allowed_origins,
|
||||
allowed_origins,
|
||||
allowed_methods: vec![Method::Get].into_iter().map(From::from).collect(),
|
||||
allowed_headers: AllowedHeaders::some(&["Authorization", "Accept"]),
|
||||
allow_credentials: true,
|
||||
|
|
|
@ -962,7 +962,7 @@ impl Response {
|
|||
/// Consumes the CORS, set expose_headers to
|
||||
/// passed headers and returns changed CORS
|
||||
fn exposed_headers(mut self, headers: &[&str]) -> Self {
|
||||
self.expose_headers = headers.into_iter().map(|s| s.to_string().into()).collect();
|
||||
self.expose_headers = headers.iter().map(|s| s.to_string().into()).collect();
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -983,7 +983,7 @@ impl Response {
|
|||
/// Consumes the CORS, set allow_headers to
|
||||
/// passed headers and returns changed CORS
|
||||
fn headers(mut self, headers: &[&str]) -> Self {
|
||||
self.allow_headers = headers.into_iter().map(|s| s.to_string().into()).collect();
|
||||
self.allow_headers = headers.iter().map(|s| s.to_string().into()).collect();
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -1624,7 +1624,7 @@ mod tests {
|
|||
assert!(failed_origins.is_empty());
|
||||
|
||||
CorsOptions {
|
||||
allowed_origins: allowed_origins,
|
||||
allowed_origins,
|
||||
allowed_methods: vec![http::Method::Get]
|
||||
.into_iter()
|
||||
.map(From::from)
|
||||
|
|
Loading…
Reference in New Issue