aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2019-08-16 01:13:10 +0200
committerChristian Duerr <contact@christianduerr.com>2019-08-16 01:33:49 +0200
commitd9d698614ce828ba96ae101f280b37c5c80f607b (patch)
treea7e6eddcd3c63422191c2d05e933387a4deebbf4
parent1da986ae2b5dd7c54875d45716eb2820920feaae (diff)
downloadalacritty-d9d698614ce828ba96ae101f280b37c5c80f607b.tar.gz
alacritty-d9d698614ce828ba96ae101f280b37c5c80f607b.zip
Fix clippy issues
-rw-r--r--alacritty_terminal/src/ansi.rs55
-rw-r--r--alacritty_terminal/src/util.rs3
-rw-r--r--copypasta/src/wayland_clipboard.rs4
-rw-r--r--rustfmt.toml2
4 files changed, 46 insertions, 18 deletions
diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs
index 3a3a192d..57ad17fd 100644
--- a/alacritty_terminal/src/ansi.rs
+++ b/alacritty_terminal/src/ansi.rs
@@ -774,7 +774,7 @@ where
// Set icon name
// This is ignored, since alacritty has no concept of tabs
- b"1" => return,
+ b"1" => (),
// Set color index
b"4" => {
@@ -903,7 +903,6 @@ where
"[Unhandled CSI] action={:?}, args={:?}, intermediates={:?}",
action, args, intermediates
);
- return;
}};
}
@@ -917,6 +916,7 @@ where
if has_ignored_intermediates || intermediates.len() > 1 {
unhandled!();
+ return;
}
let handler = &mut self.handler;
@@ -958,7 +958,10 @@ where
let mode = match arg_or_default!(idx: 0, default: 0) {
0 => TabulationClearMode::Current,
3 => TabulationClearMode::All,
- _ => unhandled!(),
+ _ => {
+ unhandled!();
+ return;
+ },
};
handler.clear_tabs(mode);
@@ -978,7 +981,10 @@ where
1 => ClearMode::Above,
2 => ClearMode::All,
3 => ClearMode::Saved,
- _ => unhandled!(),
+ _ => {
+ unhandled!();
+ return;
+ },
};
handler.clear_screen(mode);
@@ -988,7 +994,10 @@ where
0 => LineClearMode::Right,
1 => LineClearMode::Left,
2 => LineClearMode::All,
- _ => unhandled!(),
+ _ => {
+ unhandled!();
+ return;
+ },
};
handler.clear_line(mode);
@@ -1002,13 +1011,19 @@ where
let is_private_mode = match intermediate {
Some(b'?') => true,
None => false,
- _ => unhandled!(),
+ _ => {
+ unhandled!();
+ return;
+ },
};
for arg in args {
let mode = Mode::from_primitive(is_private_mode, *arg);
match mode {
Some(mode) => handler.unset_mode(mode),
- None => unhandled!(),
+ None => {
+ unhandled!();
+ return;
+ },
}
}
},
@@ -1027,13 +1042,19 @@ where
let is_private_mode = match intermediate {
Some(b'?') => true,
None => false,
- _ => unhandled!(),
+ _ => {
+ unhandled!();
+ return;
+ },
};
for arg in args {
let mode = Mode::from_primitive(is_private_mode, *arg);
match 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) {
match attr {
Some(attr) => handler.terminal_attribute(attr),
- None => unhandled!(),
+ None => {
+ unhandled!();
+ return;
+ },
}
}
}
@@ -1059,7 +1083,10 @@ where
1 | 2 => Some(CursorStyle::Block),
3 | 4 => Some(CursorStyle::Underline),
5 | 6 => Some(CursorStyle::Beam),
- _ => unhandled!(),
+ _ => {
+ unhandled!();
+ return;
+ },
};
handler.set_cursor_style(style);
@@ -1090,7 +1117,6 @@ where
"[unhandled] esc_dispatch params={:?}, ints={:?}, byte={:?} ({:02x})",
params, intermediates, byte as char, byte
);
- return;
}};
}
@@ -1101,7 +1127,10 @@ where
Some(b')') => CharsetIndex::G1,
Some(b'*') => CharsetIndex::G2,
Some(b'+') => CharsetIndex::G3,
- _ => unhandled!(),
+ _ => {
+ unhandled!();
+ return;
+ },
};
self.handler.configure_charset(index, $charset)
}};
diff --git a/alacritty_terminal/src/util.rs b/alacritty_terminal/src/util.rs
index 250fa430..7758de0f 100644
--- a/alacritty_terminal/src/util.rs
+++ b/alacritty_terminal/src/util.rs
@@ -29,8 +29,7 @@ pub mod thread {
/// Like `thread::spawn`, but with a `name` argument
pub fn spawn_named<F, T, S>(name: S, f: F) -> ::std::thread::JoinHandle<T>
where
- F: FnOnce() -> T,
- F: Send + 'static,
+ F: FnOnce() -> T + Send + 'static,
T: Send + 'static,
S: Into<String>,
{
diff --git a/copypasta/src/wayland_clipboard.rs b/copypasta/src/wayland_clipboard.rs
index b32f1290..7b9de832 100644
--- a/copypasta/src/wayland_clipboard.rs
+++ b/copypasta/src/wayland_clipboard.rs
@@ -34,14 +34,14 @@ pub struct Primary {
pub fn create_clipboards(display: &Display) -> (Primary, Clipboard) {
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) {
let context =
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 {
diff --git a/rustfmt.toml b/rustfmt.toml
index bf8f13e2..9308ba98 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -1,9 +1,9 @@
+format_code_in_doc_comments = true
match_block_trailing_comma = true
condense_wildcard_suffixes = true
use_field_init_shorthand = true
overflow_delimited_expr = true
use_small_heuristics = "Max"
-format_doc_comments = true
normalize_comments = true
reorder_impl_items = true
use_try_shorthand = true