Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable clippy in CI #706

Merged
merged 4 commits into from
Oct 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ rust:
install:
- nvm install 9
- rustup component add rustfmt
- rustup component add clippy
- rustup target add wasm32-unknown-unknown
- cargo install cargo-update || true
- cargo install-update-config --version =0.2.50 wasm-bindgen-cli
Expand All @@ -38,6 +39,5 @@ install:
- ./ci/install_cargo_web.sh

script:
- rustup target list --installed
- cargo fmt --all -- --check
- ./ci/run_checks.sh
- CHROMEDRIVER=$(pwd)/chromedriver ./ci/run_tests.sh
11 changes: 11 additions & 0 deletions ci/run_checks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

echo "$(rustup default)" | grep -q "stable"
if [ "$?" != "0" ]; then
# only run checks on stable rust for stability
exit 0
fi

set -euxo pipefail
cargo fmt --all -- --check
cargo clippy -- --deny=warnings
5 changes: 4 additions & 1 deletion src/html/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,12 @@ impl<T> ChildrenRenderer<T> {

impl<T> Default for ChildrenRenderer<T> {
fn default() -> Self {
// False positive: https://github.com/rust-lang/rust-clippy/issues/4002
#[allow(clippy::redundant_closure)]
let boxed_render = Box::new(|| Vec::new());
Self {
len: 0,
boxed_render: Box::new(|| Vec::new()),
boxed_render,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/services/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ where
callback.emit(response);
};

#[allow(clippy::too_many_arguments)]
let handle = js! {
var body = @{body};
if (@{binary} && body != null) {
Expand Down
1 change: 1 addition & 0 deletions src/virtual_dom/vnode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::iter::FromIterator;
use stdweb::web::{Element, INode, Node};

/// Bind virtual element to a DOM reference.
#[allow(clippy::large_enum_variant)] // ISSUE: #571
pub enum VNode<COMP: Component> {
/// A bind between `VTag` and `Element`.
VTag(VTag<COMP>),
Expand Down
2 changes: 1 addition & 1 deletion src/virtual_dom/vtag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ impl<COMP: Component> PartialEq for VTag<COMP> {
&& self.attributes == other.attributes
&& self.classes.set.len() == other.classes.set.len()
&& self.classes.set.iter().eq(other.classes.set.iter())
&& &self.children == &other.children
&& self.children == other.children
}
}

Expand Down