Fix clippy issues

This commit is contained in:
Christian Duerr 2019-08-16 01:13:10 +02:00
parent 1da986ae2b
commit d9d698614c
No known key found for this signature in database
GPG Key ID: 85CDAE3C164BA7B4
4 changed files with 46 additions and 18 deletions

View File

@ -774,7 +774,7 @@ where
// Set icon name // Set icon name
// This is ignored, since alacritty has no concept of tabs // This is ignored, since alacritty has no concept of tabs
b"1" => return, b"1" => (),
// Set color index // Set color index
b"4" => { b"4" => {
@ -903,7 +903,6 @@ where
"[Unhandled CSI] action={:?}, args={:?}, intermediates={:?}", "[Unhandled CSI] action={:?}, args={:?}, intermediates={:?}",
action, args, intermediates action, args, intermediates
); );
return;
}}; }};
} }
@ -917,6 +916,7 @@ where
if has_ignored_intermediates || intermediates.len() > 1 { if has_ignored_intermediates || intermediates.len() > 1 {
unhandled!(); unhandled!();
return;
} }
let handler = &mut self.handler; let handler = &mut self.handler;
@ -958,7 +958,10 @@ where
let mode = match arg_or_default!(idx: 0, default: 0) { let mode = match arg_or_default!(idx: 0, default: 0) {
0 => TabulationClearMode::Current, 0 => TabulationClearMode::Current,
3 => TabulationClearMode::All, 3 => TabulationClearMode::All,
_ => unhandled!(), _ => {
unhandled!();
return;
},
}; };
handler.clear_tabs(mode); handler.clear_tabs(mode);
@ -978,7 +981,10 @@ where
1 => ClearMode::Above, 1 => ClearMode::Above,
2 => ClearMode::All, 2 => ClearMode::All,
3 => ClearMode::Saved, 3 => ClearMode::Saved,
_ => unhandled!(), _ => {
unhandled!();
return;
},
}; };
handler.clear_screen(mode); handler.clear_screen(mode);
@ -988,7 +994,10 @@ where
0 => LineClearMode::Right, 0 => LineClearMode::Right,
1 => LineClearMode::Left, 1 => LineClearMode::Left,
2 => LineClearMode::All, 2 => LineClearMode::All,
_ => unhandled!(), _ => {
unhandled!();
return;
},
}; };
handler.clear_line(mode); handler.clear_line(mode);
@ -1002,13 +1011,19 @@ where
let is_private_mode = match intermediate { let is_private_mode = match intermediate {
Some(b'?') => true, Some(b'?') => true,
None => false, None => false,
_ => unhandled!(), _ => {
unhandled!();
return;
},
}; };
for arg in args { for arg in args {
let mode = Mode::from_primitive(is_private_mode, *arg); let mode = Mode::from_primitive(is_private_mode, *arg);
match mode { match mode {
Some(mode) => handler.unset_mode(mode), Some(mode) => handler.unset_mode(mode),
None => unhandled!(), None => {
unhandled!();
return;
},
} }
} }
}, },
@ -1027,13 +1042,19 @@ where
let is_private_mode = match intermediate { let is_private_mode = match intermediate {
Some(b'?') => true, Some(b'?') => true,
None => false, None => false,
_ => unhandled!(), _ => {
unhandled!();
return;
},
}; };
for arg in args { for arg in args {
let mode = Mode::from_primitive(is_private_mode, *arg); let mode = Mode::from_primitive(is_private_mode, *arg);
match mode { match mode {
Some(mode) => handler.set_mode(mode), Some(mode) => handler.set_mode(mode),
None => unhandled!(), None => {
unhandled!();
return;
},
} }
} }
}, },
@ -1044,7 +1065,10 @@ where
for attr in attrs_from_sgr_parameters(args) { for attr in attrs_from_sgr_parameters(args) {
match attr { match attr {
Some(attr) => handler.terminal_attribute(attr), Some(attr) => handler.terminal_attribute(attr),
None => unhandled!(), None => {
unhandled!();
return;
},
} }
} }
} }
@ -1059,7 +1083,10 @@ where
1 | 2 => Some(CursorStyle::Block), 1 | 2 => Some(CursorStyle::Block),
3 | 4 => Some(CursorStyle::Underline), 3 | 4 => Some(CursorStyle::Underline),
5 | 6 => Some(CursorStyle::Beam), 5 | 6 => Some(CursorStyle::Beam),
_ => unhandled!(), _ => {
unhandled!();
return;
},
}; };
handler.set_cursor_style(style); handler.set_cursor_style(style);
@ -1090,7 +1117,6 @@ where
"[unhandled] esc_dispatch params={:?}, ints={:?}, byte={:?} ({:02x})", "[unhandled] esc_dispatch params={:?}, ints={:?}, byte={:?} ({:02x})",
params, intermediates, byte as char, byte params, intermediates, byte as char, byte
); );
return;
}}; }};
} }
@ -1101,7 +1127,10 @@ where
Some(b')') => CharsetIndex::G1, Some(b')') => CharsetIndex::G1,
Some(b'*') => CharsetIndex::G2, Some(b'*') => CharsetIndex::G2,
Some(b'+') => CharsetIndex::G3, Some(b'+') => CharsetIndex::G3,
_ => unhandled!(), _ => {
unhandled!();
return;
},
}; };
self.handler.configure_charset(index, $charset) self.handler.configure_charset(index, $charset)
}}; }};

View File

@ -29,8 +29,7 @@ pub mod thread {
/// Like `thread::spawn`, but with a `name` argument /// Like `thread::spawn`, but with a `name` argument
pub fn spawn_named<F, T, S>(name: S, f: F) -> ::std::thread::JoinHandle<T> pub fn spawn_named<F, T, S>(name: S, f: F) -> ::std::thread::JoinHandle<T>
where where
F: FnOnce() -> T, F: FnOnce() -> T + Send + 'static,
F: Send + 'static,
T: Send + 'static, T: Send + 'static,
S: Into<String>, S: Into<String>,
{ {

View File

@ -34,14 +34,14 @@ pub struct Primary {
pub fn create_clipboards(display: &Display) -> (Primary, Clipboard) { pub fn create_clipboards(display: &Display) -> (Primary, Clipboard) {
let context = Arc::new(Mutex::new(WaylandClipboard::new(display))); let context = Arc::new(Mutex::new(WaylandClipboard::new(display)));
(Primary { context: context.clone() }, Clipboard { context } ) (Primary { context: context.clone() }, Clipboard { context })
} }
pub unsafe fn create_clipboards_from_external(display: *mut c_void) -> (Primary, Clipboard) { pub unsafe fn create_clipboards_from_external(display: *mut c_void) -> (Primary, Clipboard) {
let context = let context =
Arc::new(Mutex::new(WaylandClipboard::new_from_external(display as *mut wl_display))); Arc::new(Mutex::new(WaylandClipboard::new_from_external(display as *mut wl_display)));
(Primary { context: context.clone() }, Clipboard { context} ) (Primary { context: context.clone() }, Clipboard { context })
} }
impl ClipboardProvider for Clipboard { impl ClipboardProvider for Clipboard {

View File

@ -1,9 +1,9 @@
format_code_in_doc_comments = true
match_block_trailing_comma = true match_block_trailing_comma = true
condense_wildcard_suffixes = true condense_wildcard_suffixes = true
use_field_init_shorthand = true use_field_init_shorthand = true
overflow_delimited_expr = true overflow_delimited_expr = true
use_small_heuristics = "Max" use_small_heuristics = "Max"
format_doc_comments = true
normalize_comments = true normalize_comments = true
reorder_impl_items = true reorder_impl_items = true
use_try_shorthand = true use_try_shorthand = true