[lint] fix several warnings

This commit is contained in:
zhang_ji 2016-06-30 12:44:16 +08:00
parent eae4dd6e2e
commit d99d04dc52
8 changed files with 8 additions and 17 deletions

View file

@ -29,7 +29,7 @@ impl Curses {
use_color: false,
}
}
pub fn init(&mut self, theme: Option<&ColorTheme>, is_black: bool, use_mouse: bool) {
pub fn init(&mut self, theme: Option<&ColorTheme>, is_black: bool, _use_mouse: bool) {
// initialize ncurses
let local_conf = LcCategory::all;
setlocale(local_conf, "en_US.UTF-8"); // for showing wide characters
@ -53,13 +53,13 @@ impl Curses {
}
fn init_pairs(&mut self, base: &ColorTheme, theme: &ColorTheme, is_black: bool) {
let mut fg = shadow(base.fg, theme.fg);
//let mut fg = shadow(base.fg, theme.fg);
let mut bg = shadow(base.bg, theme.bg);
if is_black {
bg = COLOR_BLACK;
} else if theme.use_default {
fg = COLOR_DEFAULT;
//fg = COLOR_DEFAULT;
bg = COLOR_DEFAULT;
use_default_colors();
}

View file

@ -13,8 +13,6 @@ use std::time::Duration;
use util::eventbox::EventBox;
use event::{Event, parse_action};
use ncurses::*;
pub struct Input {
eb: Arc<EventBox<Event>>,
keyboard: KeyBoard,
@ -91,7 +89,7 @@ impl KeyBoard {
let (tx, rx) = channel();
thread::spawn(move || {
for ch in f.chars() {
tx.send(ch.unwrap());
let _ = tx.send(ch.unwrap());
}
});

View file

@ -1,7 +1,6 @@
// An item is line of text that read from `find` command or stdin together with
// the internal states, such as selected or not
use std;
use std::cmp::Ordering;
pub struct Item {

View file

@ -54,7 +54,7 @@ fn main() {
return
}
let theme = curses::ColorTheme::new();
let theme = ColorTheme::new();
let mut curse = Curses::new();
curse.init(Some(&theme), false, false);

View file

@ -137,7 +137,7 @@ fn match_item(index: usize, item: &str, query: &str) -> Option<MatchedItem> {
struct MatcherCache {
matched_items: OrderedVec<MatchedItem>,
pub matched_items: OrderedVec<MatchedItem>,
pub item_pos: usize,
}
@ -148,8 +148,4 @@ impl MatcherCache {
matched_items: OrderedVec::new(),
}
}
pub fn push(&mut self, matched_item: MatchedItem) {
self.matched_items.push(matched_item);
}
}

View file

@ -10,7 +10,6 @@ use std::cell::RefCell;
use std::collections::HashSet;
use orderedvec::OrderedVec;
use curses::*;
use input::Key;
use query::Query;
use util::eventbox::EventBox;
use event::Event;
@ -157,7 +156,7 @@ impl Model {
mv(y, 0);
let is_current_line = y == self.line_cursor as i32;
let mut label = if is_current_line {">"} else {" "};
let label = if is_current_line {">"} else {" "};
self.curses.cprint(COLOR_CURSOR, true, label);

View file

@ -97,7 +97,7 @@ impl Query {
pub fn delete_char(&mut self) -> bool {
if self.index == self.query.len() { return false; }
let ch = self.query.remove(self.index);
let _ = self.query.remove(self.index);
return true;
}

View file

@ -6,7 +6,6 @@ extern crate libc;
use std::process::{Command, Stdio};
use std::sync::{Arc, RwLock};
use std::io::{stdin, BufRead, BufReader};
use std::sync::mpsc::Sender;
use std::error::Error;
use util::eventbox::EventBox;
use event::Event;