Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
bastibl committed Mar 18, 2024
1 parent f8721a8 commit 4a1372f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 91 deletions.
5 changes: 2 additions & 3 deletions examples/m17/src/encoder_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ impl Kernel for EncoderBlock {
} else {
if input.len() >= 16 {
let eot = sio.input(0).finished() && input.len() <= 31;
self.syms = self
.encoder
self.encoder
.encode(&input[0..16].try_into().unwrap(), eot)
.to_owned();
.clone_into(&mut self.syms);
self.offset = 0;
sio.input(0).consume(16);
io.call_again = true;
Expand Down
7 changes: 2 additions & 5 deletions examples/rattlegram/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
[build]
target = "wasm32-unknown-unknown"

[target.wasm32-unknown-unknown]
rustflags = ["--cfg=web_sys_unstable_apis", "-Clink-arg=-zstack-size=16777216", "-Clink-arg=--import-memory", "-Clink-arg=--initial-memory=33554432", "-Clink-arg=--max-memory=4294967296"]
# [build]
# target = "wasm32-unknown-unknown"
72 changes: 0 additions & 72 deletions examples/rattlegram/src/bin/wasm_worklet.rs

This file was deleted.

22 changes: 11 additions & 11 deletions examples/rattlegram/src/wasm_decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ impl WasmDecoder {
let mut payload = [0u8; 170];

match status {
DecoderResult::Okay => return None,
DecoderResult::Okay => None,
DecoderResult::Fail => {
info!("preamble fail");
return Some(serde_json::to_string(&DecoderMessage::Fail).unwrap());
Some(serde_json::to_string(&DecoderMessage::Fail).unwrap())
}
DecoderResult::Sync => {
self.decoder.staged(&mut cfo, &mut mode, &mut call_sign);
Expand All @@ -63,15 +63,15 @@ impl WasmDecoder {
" call sign: {}",
String::from_utf8_lossy(&call_sign).trim_matches(char::from(0))
);
return Some(
Some(
serde_json::to_string(&DecoderMessage::Sync {
cfo,
call_sign: String::from_utf8_lossy(&call_sign)
.trim_matches(char::from(0))
.to_string(),
})
.unwrap(),
);
)
}
DecoderResult::Done => {
let flips = self.decoder.fetch(&mut payload);
Expand All @@ -80,19 +80,19 @@ impl WasmDecoder {
"Message: {}",
String::from_utf8_lossy(&payload).trim_matches(char::from(0))
);
return Some(
Some(
serde_json::to_string(&DecoderMessage::Done {
bit_flips: flips,
message: String::from_utf8_lossy(&payload)
.trim_matches(char::from(0))
.to_string(),
})
.unwrap(),
);
)
}
DecoderResult::Heap => {
info!("HEAP ERROR");
return Some(serde_json::to_string(&DecoderMessage::HeapError).unwrap());
Some(serde_json::to_string(&DecoderMessage::HeapError).unwrap())
}
DecoderResult::Nope => {
self.decoder.staged(&mut cfo, &mut mode, &mut call_sign);
Expand All @@ -103,15 +103,15 @@ impl WasmDecoder {
" call sign: {}",
String::from_utf8_lossy(&call_sign).trim_matches(char::from(0))
);
return Some(
Some(
serde_json::to_string(&DecoderMessage::Nope {
cfo,
call_sign: String::from_utf8_lossy(&call_sign)
.trim_matches(char::from(0))
.to_string(),
})
.unwrap(),
);
)
}
DecoderResult::Ping => {
self.decoder.staged(&mut cfo, &mut mode, &mut call_sign);
Expand All @@ -122,15 +122,15 @@ impl WasmDecoder {
" call sign: {}",
String::from_utf8_lossy(&call_sign).trim_matches(char::from(0))
);
return Some(
Some(
serde_json::to_string(&DecoderMessage::Ping {
cfo,
call_sign: String::from_utf8_lossy(&call_sign)
.trim_matches(char::from(0))
.to_string(),
})
.unwrap(),
);
)
}
_ => {
panic!("wrong decoder result");
Expand Down

0 comments on commit 4a1372f

Please sign in to comment.