Clippy code cleanup
This commit is contained in:
parent
f7710ca912
commit
945cea6acf
@ -79,7 +79,7 @@ pub fn convert_key(ev: &EventKey) -> Option<String> {
|
||||
|
||||
pub fn im_input(nvim: &mut Neovim, input: &str) {
|
||||
debug!("nvim_input -> {}", input);
|
||||
nvim.input(&input).expect("Error run input command to nvim");
|
||||
nvim.input(input).expect("Error run input command to nvim");
|
||||
}
|
||||
|
||||
pub fn gtk_key_press(nvim: &mut Neovim, ev: &EventKey) -> Inhibit {
|
||||
|
@ -20,7 +20,6 @@ extern crate htmlescape;
|
||||
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate serde;
|
||||
extern crate toml;
|
||||
|
||||
mod sys;
|
||||
|
@ -182,8 +182,8 @@ impl Projects {
|
||||
let uri_value = list_store.get_value(&iter, ProjectViewColumns::Uri as i32);
|
||||
let uri: String = uri_value.get().unwrap();
|
||||
|
||||
let mut store = self.store.as_mut().unwrap();
|
||||
if let Some(mut entry) = store.find_mut(&uri) {
|
||||
let store = self.store.as_mut().unwrap();
|
||||
if let Some(entry) = store.find_mut(&uri) {
|
||||
entry.stored = !value;
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ pub fn shape_dirty(
|
||||
|
||||
for i in 0..line.line.len() {
|
||||
if line[i].dirty {
|
||||
if let Some(mut item) = line.get_item_mut(i) {
|
||||
if let Some(item) = line.get_item_mut(i) {
|
||||
let mut glyphs = pango::GlyphString::new();
|
||||
{
|
||||
let analysis = item.analysis();
|
||||
|
10
src/shell.rs
10
src/shell.rs
@ -462,7 +462,7 @@ impl Shell {
|
||||
|
||||
pub fn edit_save_all(&self) {
|
||||
let state = self.state.borrow();
|
||||
let mut nvim = &mut *state.nvim();
|
||||
let nvim = &mut *state.nvim();
|
||||
nvim.command(":wa").report_err(nvim);
|
||||
}
|
||||
|
||||
@ -591,7 +591,7 @@ fn gtk_draw(state_arc: &Arc<UiMutex<State>>, ctx: &cairo::Context) -> Inhibit {
|
||||
Inhibit(false)
|
||||
}
|
||||
|
||||
fn show_nvim_start_error(err: nvim::NvimInitError, state_arc: Arc<UiMutex<State>>) {
|
||||
fn show_nvim_start_error(err: &nvim::NvimInitError, state_arc: Arc<UiMutex<State>>) {
|
||||
let source = err.source();
|
||||
let cmd = err.cmd().unwrap().to_owned();
|
||||
|
||||
@ -605,7 +605,7 @@ fn show_nvim_start_error(err: nvim::NvimInitError, state_arc: Arc<UiMutex<State>
|
||||
});
|
||||
}
|
||||
|
||||
fn show_nvim_init_error(err: nvim::NvimInitError, state_arc: Arc<UiMutex<State>>) {
|
||||
fn show_nvim_init_error(err: &nvim::NvimInitError, state_arc: Arc<UiMutex<State>>) {
|
||||
let source = err.source();
|
||||
|
||||
glib::idle_add(move || {
|
||||
@ -628,7 +628,7 @@ fn init_nvim_async(
|
||||
let mut nvim = match nvim::start(state_arc.clone(), options.nvim_bin_path.as_ref()) {
|
||||
Ok(nvim) => nvim,
|
||||
Err(err) => {
|
||||
show_nvim_start_error(err, state_arc);
|
||||
show_nvim_start_error(&err, state_arc);
|
||||
return;
|
||||
}
|
||||
};
|
||||
@ -653,7 +653,7 @@ fn init_nvim_async(
|
||||
rows as u64,
|
||||
)
|
||||
{
|
||||
show_nvim_init_error(err, state_arc.clone());
|
||||
show_nvim_init_error(&err, state_arc.clone());
|
||||
} else {
|
||||
let mut state = state_arc.borrow_mut();
|
||||
state.nvim.borrow_mut().set_initialized(nvim);
|
||||
|
@ -93,8 +93,7 @@ impl Line {
|
||||
// update only if cell marked as dirty
|
||||
if self.line[new_item.start_cell..new_item.end_cell + 1]
|
||||
.iter()
|
||||
.find(|c| c.dirty)
|
||||
.is_some()
|
||||
.any(|c| c.dirty)
|
||||
{
|
||||
self.item_line[new_item.start_cell]
|
||||
.as_mut()
|
||||
|
@ -72,11 +72,11 @@ impl UiModel {
|
||||
|
||||
pub fn put(&mut self, text: &str, attrs: Option<&Attrs>) -> ModelRect {
|
||||
let mut changed_region = self.cur_point();
|
||||
let mut line = &mut self.model[self.cur_row];
|
||||
let line = &mut self.model[self.cur_row];
|
||||
line.dirty_line = true;
|
||||
line.mark_dirty_cell(self.cur_col);
|
||||
|
||||
let mut cell = &mut line[self.cur_col];
|
||||
let cell = &mut line[self.cur_col];
|
||||
|
||||
cell.ch = text.chars().last().unwrap_or(' ');
|
||||
cell.attrs = attrs.map(Attrs::clone).unwrap_or_else(Attrs::new);
|
||||
@ -100,7 +100,7 @@ impl UiModel {
|
||||
|
||||
#[inline]
|
||||
fn copy_row(&mut self, target_row: i64, offset: i64, left_col: usize, right_col: usize) {
|
||||
debug_assert!(offset != 0);
|
||||
debug_assert_ne!(0, offset);
|
||||
|
||||
let from_row = (target_row + offset) as usize;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user