Skip to content

Commit

Permalink
cargo clippy and fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
bastibl committed Nov 12, 2023
1 parent 687cddd commit 7fa529d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
1 change: 0 additions & 1 deletion crates/prophecy/src/array_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,3 @@ macro_rules! impl_array_view {
impl_array_view!(f32, Float32Array, WebGl2RenderingContext::FLOAT);
impl_array_view!(u16, Uint16Array, WebGl2RenderingContext::UNSIGNED_INT);
impl_array_view!(u8, Uint8Array, WebGl2RenderingContext::UNSIGNED_BYTE);

5 changes: 4 additions & 1 deletion crates/prophecy/src/constellation_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ pub fn ConstellationSink(
gl.bind_buffer(GL::ARRAY_BUFFER, Some(&vertex_buffer));

let state = Rc::new(RefCell::new(RenderState {
canvas, gl, shader, vertex_len: 0
canvas,
gl,
shader,
vertex_len: 0,
}));
request_animation_frame(render(state, data))
});
Expand Down
7 changes: 3 additions & 4 deletions crates/prophecy/src/constellation_sink_density.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ fn render(
let p = bytes.as_ptr();
std::slice::from_raw_parts(p as *const Complex32, s)
};

let decay = 0.999f32.powi(samples.len() as i32);
texture.iter_mut().for_each(|v| *v *= decay);

let width = width.get_untracked();
for s in samples.into_iter() {
for s in samples.iter() {
let w = ((s.re + width) / (2.0 * width) * BINS as f32).round() as i64;
if w >= 0 && w < BINS as i64 {
let h = ((s.im + width) / (2.0 * width) * BINS as f32).round() as i64;
Expand All @@ -213,7 +213,7 @@ fn render(
}
}

let view = unsafe {f32::view(texture) };
let view = unsafe { f32::view(texture) };
gl.tex_sub_image_2d_with_i32_and_i32_and_u32_and_type_and_array_buffer_view_and_src_offset(
GL::TEXTURE_2D,
0,
Expand All @@ -234,4 +234,3 @@ fn render(
request_animation_frame(render(state, data))
}
}

7 changes: 3 additions & 4 deletions examples/wlan/src/frame_equalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ impl FrameEqualizer {
.add_input::<Complex32>("in")
.add_output::<u8>("out")
.build(),
MessageIoBuilder::new()
.add_output("symbols")
.build(),
MessageIoBuilder::new().add_output("symbols").build(),
Self {
equalizer: Equalizer::new(),
state: State::Skip,
Expand Down Expand Up @@ -329,7 +327,8 @@ impl Kernel for FrameEqualizer {
n_sym -= 1;
if n_sym == 0 {
if !self.syms.is_empty() {
mio.post(0, Pmt::VecCF32(std::mem::take(&mut self.syms))).await;
mio.post(0, Pmt::VecCF32(std::mem::take(&mut self.syms)))
.await;
}
self.state = State::Skip;
} else {
Expand Down
4 changes: 2 additions & 2 deletions examples/wlan/src/wasm/frontend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use futuresdr::runtime::Pmt;
use leptos::html::Span;
use leptos::wasm_bindgen::JsCast;
use leptos::*;
use prophecy::ConstellationSinkDensity;
use prophecy::FlowgraphHandle;
use prophecy::FlowgraphMermaid;
use prophecy::ListSelector;
use prophecy::RadioSelector;
use prophecy::RuntimeHandle;
use prophecy::ConstellationSinkDensity;
use prophecy::ListSelector;
use web_sys::HtmlInputElement;

#[component]
Expand Down
3 changes: 1 addition & 2 deletions src/blocks/websocket_pmt_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,12 @@ impl Kernel for WebsocketPmtSink {
Some(Pmt::VecCF32(v)) => {
let v: Vec<u8> = v
.into_iter()
.map(|f| {
.flat_map(|f| {
let mut b = [0; 8];
b[..4].copy_from_slice(&f.re.to_le_bytes());
b[4..].copy_from_slice(&f.im.to_le_bytes());
b
})
.flatten()
.collect();
if !v.is_empty() {
let acc = Box::pin(self.listener.as_ref().context("no listener")?.accept());
Expand Down

0 comments on commit 7fa529d

Please sign in to comment.