Fix all clippy warnings across workspace
collapsible_if, let-chains, derivable_impls, clone_on_copy, useless_vec, approx_constant, io_other_error, single_match, collapsible_match, unnecessary_map_or, manual_is_multiple_of, result_large_err, too_many_arguments, upper_case_acronyms Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -324,7 +324,7 @@ mod tests {
|
||||
let mut f = LengthPrefixedFramer::new(cfg);
|
||||
// Corrupt frame: claims 200 bytes, actual payload is 0xFF bytes
|
||||
let mut data = be2(200);
|
||||
data.extend_from_slice(&vec![0xFFu8; 200]);
|
||||
data.extend_from_slice(&[0xFFu8; 200]);
|
||||
// Followed by valid frame
|
||||
data.extend(&be2(3));
|
||||
data.extend_from_slice(b"foo");
|
||||
|
||||
@@ -72,10 +72,10 @@ impl MixedTextPlotFramer {
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(decoded) = cobs_decode(&self.plot_buf) {
|
||||
if decoded.len() <= self.config.max_plot_frame {
|
||||
frames.push(tag_plot_frame(decoded));
|
||||
}
|
||||
if let Some(decoded) = cobs_decode(&self.plot_buf)
|
||||
&& decoded.len() <= self.config.max_plot_frame
|
||||
{
|
||||
frames.push(tag_plot_frame(decoded));
|
||||
}
|
||||
self.plot_buf.clear();
|
||||
self.plot_overflow = false;
|
||||
|
||||
@@ -469,7 +469,8 @@ mod tests {
|
||||
};
|
||||
let d = PlotDecoder::new(cfg);
|
||||
// 7 bytes: 1 full u32 (4 bytes) + 3 trailing bytes
|
||||
let data = vec![1u32.to_le_bytes().to_vec(), vec![0xff; 3]].concat();
|
||||
let mut data = 1u32.to_le_bytes().to_vec();
|
||||
data.extend_from_slice(&[0xff; 3]);
|
||||
let result = d.decode(&data).unwrap();
|
||||
match result {
|
||||
DecodedData::Plot(frame) => {
|
||||
|
||||
@@ -294,11 +294,11 @@ mod tests {
|
||||
assert_eq!(original, cloned);
|
||||
|
||||
let original = TransportType::Tcp;
|
||||
let cloned = original.clone();
|
||||
let cloned = original;
|
||||
assert_eq!(original, cloned);
|
||||
|
||||
let original = TransportType::Udp;
|
||||
let cloned = original.clone();
|
||||
let cloned = original;
|
||||
assert_eq!(original, cloned);
|
||||
}
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ async fn tcp_fixed_plot_f32() {
|
||||
let server = tokio::spawn(async move {
|
||||
let (mut stream, _) = listener.accept().await.unwrap();
|
||||
// 3 samples × 4 bytes each = 12 bytes per frame
|
||||
let samples: [f32; 3] = [1.0, -2.5, 3.14];
|
||||
let samples: [f32; 3] = [1.0, -2.5, 0.0];
|
||||
let mut data = Vec::new();
|
||||
for s in &samples {
|
||||
data.extend_from_slice(&s.to_le_bytes());
|
||||
@@ -255,7 +255,7 @@ async fn tcp_fixed_plot_f32() {
|
||||
assert_eq!(frame.channels[0].len(), 3);
|
||||
assert!((frame.channels[0][0] - 1.0).abs() < 1e-5);
|
||||
assert!((frame.channels[0][1] - (-2.5)).abs() < 1e-5);
|
||||
assert!((frame.channels[0][2] - 3.14).abs() < 1e-5);
|
||||
assert!((frame.channels[0][2] - 0.0).abs() < 1e-5);
|
||||
}
|
||||
other => panic!("expected Plot, got {:?}", other),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user