neiam
/koco
public · Issues · Pulls · Labels · Forks · Compare · Actions failure · Badges · Packages
⭐
Log in to mark this repository.
re-fmt clippy
526a5f0 · gmorell · 2025-12-26 03:24
Files changed
modified
src/main.rs
+57
−42
@@ -738,9 +738,11 @@ impl Koco {
| 738 | 738 | loop { |
| 739 | 739 | interval.tick().await; |
| 740 | 740 | if let Ok(mut np) = now_playing.lock() |
| 741 | − && np.playing && np.position < np.duration { | |
| 742 | − np.position += 1.0; | |
| 743 | − } | |
| 741 | + && np.playing | |
| 742 | + && np.position < np.duration | |
| 743 | + { | |
| 744 | + np.position += 1.0; | |
| 745 | + } | |
| 744 | 746 | } |
| 745 | 747 | }); |
| 746 | 748 | } |
@@ -1034,33 +1036,40 @@ impl eframe::App for Koco {
| 1034 | 1036 | if let Some(instance) = self.current_instance() { |
| 1035 | 1037 | ctx.input(|i| { |
| 1036 | 1038 | if i.key_pressed(egui::Key::ArrowUp) |
| 1037 | − && let Err(e) = instance.send_key("up") { | |
| 1038 | − info!("Failed to send up command: {}", e); | |
| 1039 | − } | |
| 1039 | + && let Err(e) = instance.send_key("up") | |
| 1040 | + { | |
| 1041 | + info!("Failed to send up command: {}", e); | |
| 1042 | + } | |
| 1040 | 1043 | if i.key_pressed(egui::Key::ArrowDown) |
| 1041 | − && let Err(e) = instance.send_key("down") { | |
| 1042 | − info!("Failed to send down command: {}", e); | |
| 1043 | − } | |
| 1044 | + && let Err(e) = instance.send_key("down") | |
| 1045 | + { | |
| 1046 | + info!("Failed to send down command: {}", e); | |
| 1047 | + } | |
| 1044 | 1048 | if i.key_pressed(egui::Key::ArrowLeft) |
| 1045 | − && let Err(e) = instance.send_key("left") { | |
| 1046 | − info!("Failed to send left command: {}", e); | |
| 1047 | − } | |
| 1049 | + && let Err(e) = instance.send_key("left") | |
| 1050 | + { | |
| 1051 | + info!("Failed to send left command: {}", e); | |
| 1052 | + } | |
| 1048 | 1053 | if i.key_pressed(egui::Key::ArrowRight) |
| 1049 | − && let Err(e) = instance.send_key("right") { | |
| 1050 | − info!("Failed to send right command: {}", e); | |
| 1051 | − } | |
| 1054 | + && let Err(e) = instance.send_key("right") | |
| 1055 | + { | |
| 1056 | + info!("Failed to send right command: {}", e); | |
| 1057 | + } | |
| 1052 | 1058 | if i.key_pressed(egui::Key::Enter) |
| 1053 | − && let Err(e) = instance.send_key("select") { | |
| 1054 | − info!("Failed to send select command: {}", e); | |
| 1055 | − } | |
| 1059 | + && let Err(e) = instance.send_key("select") | |
| 1060 | + { | |
| 1061 | + info!("Failed to send select command: {}", e); | |
| 1062 | + } | |
| 1056 | 1063 | if (i.key_pressed(egui::Key::Escape) || i.key_pressed(egui::Key::Backspace)) |
| 1057 | − && let Err(e) = instance.send_key("back") { | |
| 1058 | − info!("Failed to send back command: {}", e); | |
| 1059 | − } | |
| 1064 | + && let Err(e) = instance.send_key("back") | |
| 1065 | + { | |
| 1066 | + info!("Failed to send back command: {}", e); | |
| 1067 | + } | |
| 1060 | 1068 | if i.key_pressed(egui::Key::Space) |
| 1061 | − && let Err(e) = instance.send_key("playpause") { | |
| 1062 | − info!("Failed to send playpause command: {}", e); | |
| 1063 | − } | |
| 1069 | + && let Err(e) = instance.send_key("playpause") | |
| 1070 | + { | |
| 1071 | + info!("Failed to send playpause command: {}", e); | |
| 1072 | + } | |
| 1064 | 1073 | }); |
| 1065 | 1074 | } |
| 1066 | 1075 |
@@ -1115,9 +1124,10 @@ impl eframe::App for Koco {
| 1115 | 1124 | ), |
| 1116 | 1125 | ) |
| 1117 | 1126 | .clicked() |
| 1118 | − && let Err(e) = instance.send_key("up") { | |
| 1119 | − info!("Failed to send up command: {}", e); | |
| 1120 | − } | |
| 1127 | + && let Err(e) = instance.send_key("up") | |
| 1128 | + { | |
| 1129 | + info!("Failed to send up command: {}", e); | |
| 1130 | + } | |
| 1121 | 1131 | ui.label(""); // Empty cell |
| 1122 | 1132 | ui.end_row(); |
| 1123 | 1133 |
@@ -1133,9 +1143,10 @@ impl eframe::App for Koco {
| 1133 | 1143 | ), |
| 1134 | 1144 | ) |
| 1135 | 1145 | .clicked() |
| 1136 | − && let Err(e) = instance.send_key("left") { | |
| 1137 | − info!("Failed to send left command: {}", e); | |
| 1138 | − } | |
| 1146 | + && let Err(e) = instance.send_key("left") | |
| 1147 | + { | |
| 1148 | + info!("Failed to send left command: {}", e); | |
| 1149 | + } | |
| 1139 | 1150 | if ui |
| 1140 | 1151 | .add_sized( |
| 1141 | 1152 | [80.0, 80.0], |
@@ -1147,9 +1158,10 @@ impl eframe::App for Koco {
| 1147 | 1158 | ), |
| 1148 | 1159 | ) |
| 1149 | 1160 | .clicked() |
| 1150 | − && let Err(e) = instance.send_key("select") { | |
| 1151 | − info!("Failed to send select command: {}", e); | |
| 1152 | − } | |
| 1161 | + && let Err(e) = instance.send_key("select") | |
| 1162 | + { | |
| 1163 | + info!("Failed to send select command: {}", e); | |
| 1164 | + } | |
| 1153 | 1165 | if ui |
| 1154 | 1166 | .add_sized( |
| 1155 | 1167 | [80.0, 80.0], |
@@ -1161,9 +1173,10 @@ impl eframe::App for Koco {
| 1161 | 1173 | ), |
| 1162 | 1174 | ) |
| 1163 | 1175 | .clicked() |
| 1164 | − && let Err(e) = instance.send_key("right") { | |
| 1165 | − info!("Failed to send right command: {}", e); | |
| 1166 | − } | |
| 1176 | + && let Err(e) = instance.send_key("right") | |
| 1177 | + { | |
| 1178 | + info!("Failed to send right command: {}", e); | |
| 1179 | + } | |
| 1167 | 1180 | ui.end_row(); |
| 1168 | 1181 | |
| 1169 | 1182 | // Row 3: Empty, Down, Empty |
@@ -1178,9 +1191,10 @@ impl eframe::App for Koco {
| 1178 | 1191 | ), |
| 1179 | 1192 | ) |
| 1180 | 1193 | .clicked() |
| 1181 | − && let Err(e) = instance.send_key("back") { | |
| 1182 | − info!("Failed to send back command: {}", e); | |
| 1183 | − } | |
| 1194 | + && let Err(e) = instance.send_key("back") | |
| 1195 | + { | |
| 1196 | + info!("Failed to send back command: {}", e); | |
| 1197 | + } | |
| 1184 | 1198 | if ui |
| 1185 | 1199 | .add_sized( |
| 1186 | 1200 | [80.0, 80.0], |
@@ -1192,9 +1206,10 @@ impl eframe::App for Koco {
| 1192 | 1206 | ), |
| 1193 | 1207 | ) |
| 1194 | 1208 | .clicked() |
| 1195 | − && let Err(e) = instance.send_key("down") { | |
| 1196 | − info!("Failed to send down command: {}", e); | |
| 1197 | − } | |
| 1209 | + && let Err(e) = instance.send_key("down") | |
| 1210 | + { | |
| 1211 | + info!("Failed to send down command: {}", e); | |
| 1212 | + } | |
| 1198 | 1213 | ui.label(""); // Empty cell |
| 1199 | 1214 | ui.end_row(); |
| 1200 | 1215 | }); |
Parents: 19cd5f9