From 210adef0d1d1cc415747db7d5da2c3723b34ee27 Mon Sep 17 00:00:00 2001 From: Ville Hakulinen Date: Thu, 23 Jul 2020 15:55:16 +0300 Subject: Add clippy to CI --- .travis.yml | 4 +++- src/thread_guard.rs | 1 + src/ui/color.rs | 1 + src/ui/popupmenu/popupmenu.rs | 1 + src/ui/ui.rs | 1 + 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d07f601..4ec4840 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,11 +10,13 @@ matrix: - rust: nightly fast_finish: true before_script: - - rustup component add rustfmt + - rustup component add rustfmt clippy - sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev script: - cargo fmt --all -- --check - cargo build - cargo build --no-default-features # build without webkit2gtk + - cargo clippy -- -D warnings # run clippy + - cargo clippy --no-default-features -- -D warnings # run clippy without webkit2gtk - cargo test - cargo test --no-default-features # test without webkit2gtk diff --git a/src/thread_guard.rs b/src/thread_guard.rs index 97c571d..c87ba66 100644 --- a/src/thread_guard.rs +++ b/src/thread_guard.rs @@ -20,6 +20,7 @@ impl ThreadGuard { } } + #[allow(unused)] pub fn borrow(&self) -> Ref { match self.check_thread() { Ok(_) => self.data.borrow(), diff --git a/src/ui/color.rs b/src/ui/color.rs index e3d1f7b..6d7260a 100644 --- a/src/ui/color.rs +++ b/src/ui/color.rs @@ -118,6 +118,7 @@ pub struct Color { } impl Color { + #[allow(unused)] pub fn from_hex_string(mut hex: String) -> Result { let l = hex.chars().count(); if l == 7 { diff --git a/src/ui/popupmenu/popupmenu.rs b/src/ui/popupmenu/popupmenu.rs index 2006060..75addf9 100644 --- a/src/ui/popupmenu/popupmenu.rs +++ b/src/ui/popupmenu/popupmenu.rs @@ -292,6 +292,7 @@ impl Popupmenu { self.show_menu_on_all_items = b; } + #[allow(unused)] pub fn is_above_anchor(&self) -> bool { self.scrolled_list.get_child().unwrap().get_valign() == gtk::Align::End } diff --git a/src/ui/ui.rs b/src/ui/ui.rs index 930098b..c337b47 100644 --- a/src/ui/ui.rs +++ b/src/ui/ui.rs @@ -281,6 +281,7 @@ impl UI { } } +#[cfg_attr(not(feature = "libwebkit2gtk"), allow(unused_variables))] // Silence clippy fn handle_request( request: &Request, state: &mut UIState, -- cgit v1.2.3