summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVille Hakulinen <ville.hakulinen@gmail.com>2020-07-23 15:55:16 +0300
committerVille Hakulinen <ville.hakulinen@gmail.com>2020-07-23 15:55:16 +0300
commit210adef0d1d1cc415747db7d5da2c3723b34ee27 (patch)
tree624461beb6dedf2bcea3ca6cddbe22d366d8e3a8
parentdb51b11c083e6e33934baf13807f28430c5bf697 (diff)
Add clippy to CI
-rw-r--r--.travis.yml4
-rw-r--r--src/thread_guard.rs1
-rw-r--r--src/ui/color.rs1
-rw-r--r--src/ui/popupmenu/popupmenu.rs1
-rw-r--r--src/ui/ui.rs1
5 files changed, 7 insertions, 1 deletions
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<T> ThreadGuard<T> {
}
}
+ #[allow(unused)]
pub fn borrow(&self) -> Ref<T> {
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<Color, String> {
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,