mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-05-29 22:29:27 -07:00
Fix various clippy warnings
This commit fixes various clippy warnings that do not affect the function of the code and aren't stylistic in nature.
This commit is contained in:
committed by
Will Greenberg
parent
9c26e89b24
commit
d0d01089dd
@@ -88,11 +88,9 @@ async fn pcapify(qmdl_path: &PathBuf) {
|
||||
let mut pcap_writer = GsmtapPcapWriter::new(pcap_file).await.unwrap();
|
||||
pcap_writer.write_iface_header().await.unwrap();
|
||||
while let Some(container) = qmdl_reader.get_next_messages_container().await.expect("failed to get container") {
|
||||
for maybe_msg in container.into_messages() {
|
||||
if let Ok(msg) = maybe_msg {
|
||||
if let Ok(Some((timestamp, parsed))) = gsmtap_parser::parse(msg) {
|
||||
pcap_writer.write_gsmtap_message(parsed, timestamp).await.expect("failed to write");
|
||||
}
|
||||
for msg in container.into_messages().into_iter().flatten() {
|
||||
if let Ok(Some((timestamp, parsed))) = gsmtap_parser::parse(msg) {
|
||||
pcap_writer.write_gsmtap_message(parsed, timestamp).await.expect("failed to write");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +195,8 @@ fn update_ui(task_tracker: &TaskTracker, config: &config::Config, mut ui_shutdo
|
||||
fb.draw_line(framebuffer::Color565::Pink, 50);
|
||||
fb.draw_line(framebuffer::Color565::Cyan, 25);
|
||||
},
|
||||
1 | _ => {
|
||||
_ => { // this branch id for ui_level 1, which is also the default if an
|
||||
// unknown value is used
|
||||
fb.draw_line(display_color, 2);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -104,7 +104,7 @@ pub fn run_diag_read_thread(
|
||||
}
|
||||
let mut qmdl_store = qmdl_store_lock.write().await;
|
||||
let index = qmdl_store.current_entry.expect("DiagDevice had qmdl_writer, but QmdlStore didn't have current entry???");
|
||||
qmdl_store.update_entry_analysis_size(index, analysis_file_len as usize).await
|
||||
qmdl_store.update_entry_analysis_size(index, analysis_file_len).await
|
||||
.expect("failed to update analysis file size");
|
||||
}
|
||||
},
|
||||
@@ -130,12 +130,11 @@ pub async fn start_recording(State(state): State<Arc<ServerState>>) -> Result<(S
|
||||
state.diag_device_ctrl_sender.send(DiagDeviceCtrlMessage::StartRecording((qmdl_writer, analysis_file))).await
|
||||
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, format!("couldn't send stop recording message: {}", e)))?;
|
||||
|
||||
let display_state: framebuffer::DisplayState;
|
||||
if state.colorblind_mode {
|
||||
display_state = framebuffer::DisplayState::RecordingCBM;
|
||||
let display_state = if state.colorblind_mode {
|
||||
framebuffer::DisplayState::RecordingCBM
|
||||
} else {
|
||||
display_state = framebuffer::DisplayState::Recording;
|
||||
}
|
||||
framebuffer::DisplayState::Recording
|
||||
};
|
||||
state.ui_update_sender.send(display_state).await
|
||||
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, format!("couldn't send ui update message: {}", e)))?;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ pub struct ServerState {
|
||||
pub async fn get_qmdl(State(state): State<Arc<ServerState>>, Path(qmdl_name): Path<String>) -> Result<Response, (StatusCode, String)> {
|
||||
let qmdl_idx = qmdl_name.trim_end_matches(".qmdl");
|
||||
let qmdl_store = state.qmdl_store_lock.read().await;
|
||||
let (entry_index, entry) = qmdl_store.entry_for_name(&qmdl_idx)
|
||||
let (entry_index, entry) = qmdl_store.entry_for_name(qmdl_idx)
|
||||
.ok_or((StatusCode::NOT_FOUND, format!("couldn't find qmdl file with name {}", qmdl_idx)))?;
|
||||
let qmdl_file = qmdl_store.open_entry_qmdl(entry_index).await
|
||||
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, format!("error opening QMDL file: {}", e)))?;
|
||||
|
||||
Reference in New Issue
Block a user