Skip to content

Commit d9d6986

Browse files
committed
Fix clippy issues
1 parent 1da986a commit d9d6986

File tree

4 files changed

+46
-18
lines changed

4 files changed

+46
-18
lines changed

Diff for: alacritty_terminal/src/ansi.rs

+42-13
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ where
774774

775775
// Set icon name
776776
// This is ignored, since alacritty has no concept of tabs
777-
b"1" => return,
777+
b"1" => (),
778778

779779
// Set color index
780780
b"4" => {
@@ -903,7 +903,6 @@ where
903903
"[Unhandled CSI] action={:?}, args={:?}, intermediates={:?}",
904904
action, args, intermediates
905905
);
906-
return;
907906
}};
908907
}
909908

@@ -917,6 +916,7 @@ where
917916

918917
if has_ignored_intermediates || intermediates.len() > 1 {
919918
unhandled!();
919+
return;
920920
}
921921

922922
let handler = &mut self.handler;
@@ -958,7 +958,10 @@ where
958958
let mode = match arg_or_default!(idx: 0, default: 0) {
959959
0 => TabulationClearMode::Current,
960960
3 => TabulationClearMode::All,
961-
_ => unhandled!(),
961+
_ => {
962+
unhandled!();
963+
return;
964+
},
962965
};
963966

964967
handler.clear_tabs(mode);
@@ -978,7 +981,10 @@ where
978981
1 => ClearMode::Above,
979982
2 => ClearMode::All,
980983
3 => ClearMode::Saved,
981-
_ => unhandled!(),
984+
_ => {
985+
unhandled!();
986+
return;
987+
},
982988
};
983989

984990
handler.clear_screen(mode);
@@ -988,7 +994,10 @@ where
988994
0 => LineClearMode::Right,
989995
1 => LineClearMode::Left,
990996
2 => LineClearMode::All,
991-
_ => unhandled!(),
997+
_ => {
998+
unhandled!();
999+
return;
1000+
},
9921001
};
9931002

9941003
handler.clear_line(mode);
@@ -1002,13 +1011,19 @@ where
10021011
let is_private_mode = match intermediate {
10031012
Some(b'?') => true,
10041013
None => false,
1005-
_ => unhandled!(),
1014+
_ => {
1015+
unhandled!();
1016+
return;
1017+
},
10061018
};
10071019
for arg in args {
10081020
let mode = Mode::from_primitive(is_private_mode, *arg);
10091021
match mode {
10101022
Some(mode) => handler.unset_mode(mode),
1011-
None => unhandled!(),
1023+
None => {
1024+
unhandled!();
1025+
return;
1026+
},
10121027
}
10131028
}
10141029
},
@@ -1027,13 +1042,19 @@ where
10271042
let is_private_mode = match intermediate {
10281043
Some(b'?') => true,
10291044
None => false,
1030-
_ => unhandled!(),
1045+
_ => {
1046+
unhandled!();
1047+
return;
1048+
},
10311049
};
10321050
for arg in args {
10331051
let mode = Mode::from_primitive(is_private_mode, *arg);
10341052
match mode {
10351053
Some(mode) => handler.set_mode(mode),
1036-
None => unhandled!(),
1054+
None => {
1055+
unhandled!();
1056+
return;
1057+
},
10371058
}
10381059
}
10391060
},
@@ -1044,7 +1065,10 @@ where
10441065
for attr in attrs_from_sgr_parameters(args) {
10451066
match attr {
10461067
Some(attr) => handler.terminal_attribute(attr),
1047-
None => unhandled!(),
1068+
None => {
1069+
unhandled!();
1070+
return;
1071+
},
10481072
}
10491073
}
10501074
}
@@ -1059,7 +1083,10 @@ where
10591083
1 | 2 => Some(CursorStyle::Block),
10601084
3 | 4 => Some(CursorStyle::Underline),
10611085
5 | 6 => Some(CursorStyle::Beam),
1062-
_ => unhandled!(),
1086+
_ => {
1087+
unhandled!();
1088+
return;
1089+
},
10631090
};
10641091

10651092
handler.set_cursor_style(style);
@@ -1090,7 +1117,6 @@ where
10901117
"[unhandled] esc_dispatch params={:?}, ints={:?}, byte={:?} ({:02x})",
10911118
params, intermediates, byte as char, byte
10921119
);
1093-
return;
10941120
}};
10951121
}
10961122

@@ -1101,7 +1127,10 @@ where
11011127
Some(b')') => CharsetIndex::G1,
11021128
Some(b'*') => CharsetIndex::G2,
11031129
Some(b'+') => CharsetIndex::G3,
1104-
_ => unhandled!(),
1130+
_ => {
1131+
unhandled!();
1132+
return;
1133+
},
11051134
};
11061135
self.handler.configure_charset(index, $charset)
11071136
}};

Diff for: alacritty_terminal/src/util.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ pub mod thread {
2929
/// Like `thread::spawn`, but with a `name` argument
3030
pub fn spawn_named<F, T, S>(name: S, f: F) -> ::std::thread::JoinHandle<T>
3131
where
32-
F: FnOnce() -> T,
33-
F: Send + 'static,
32+
F: FnOnce() -> T + Send + 'static,
3433
T: Send + 'static,
3534
S: Into<String>,
3635
{

Diff for: copypasta/src/wayland_clipboard.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ pub struct Primary {
3434
pub fn create_clipboards(display: &Display) -> (Primary, Clipboard) {
3535
let context = Arc::new(Mutex::new(WaylandClipboard::new(display)));
3636

37-
(Primary { context: context.clone() }, Clipboard { context } )
37+
(Primary { context: context.clone() }, Clipboard { context })
3838
}
3939

4040
pub unsafe fn create_clipboards_from_external(display: *mut c_void) -> (Primary, Clipboard) {
4141
let context =
4242
Arc::new(Mutex::new(WaylandClipboard::new_from_external(display as *mut wl_display)));
4343

44-
(Primary { context: context.clone() }, Clipboard { context} )
44+
(Primary { context: context.clone() }, Clipboard { context })
4545
}
4646

4747
impl ClipboardProvider for Clipboard {

Diff for: rustfmt.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
format_code_in_doc_comments = true
12
match_block_trailing_comma = true
23
condense_wildcard_suffixes = true
34
use_field_init_shorthand = true
45
overflow_delimited_expr = true
56
use_small_heuristics = "Max"
6-
format_doc_comments = true
77
normalize_comments = true
88
reorder_impl_items = true
99
use_try_shorthand = true

0 commit comments

Comments
 (0)