Skip to content

Commit 8d1632e

Browse files
committed
run clippy and fmt
1 parent 18f2846 commit 8d1632e

20 files changed

Lines changed: 3157 additions & 3042 deletions

File tree

src/core/al-core/src/image/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ impl Image for ImageType {
311311
for image in images {
312312
image.insert_into_3d_texture(textures, offset)?
313313
}
314-
},
314+
}
315315
ImageType::Blob { .. } => unreachable!(),
316316
ImageType::Canvas { canvas } => canvas.insert_into_3d_texture(textures, offset)?,
317317
ImageType::ImageRgba8u { image } => image.insert_into_3d_texture(textures, offset)?,

src/core/src/app.rs

Lines changed: 86 additions & 73 deletions
Large diffs are not rendered by default.

src/core/src/camera/view_hpx_cells.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ impl ViewHpxCells {
8080
}
8181
}
8282

83-
pub(super) fn get_cells(&self, depth: u8, frame: CooSystem) -> Box<dyn Iterator<Item = HEALPixCell> + '_> {
83+
pub(super) fn get_cells(
84+
&self,
85+
depth: u8,
86+
frame: CooSystem,
87+
) -> Box<dyn Iterator<Item = HEALPixCell> + '_> {
8488
self.hpx_cells[frame as usize].get_cells(depth)
8589
}
8690

@@ -204,21 +208,21 @@ impl HpxCells {
204208
Box::new(
205209
self.cov
206210
.flatten_to_fixed_depth_cells()
207-
.map(move |idx| HEALPixCell(depth, idx))
211+
.map(move |idx| HEALPixCell(depth, idx)),
208212
)
209213
} else if depth > cov_depth {
210214
let cov_d = cov_depth;
211215
let dd = depth - cov_d;
212216
Box::new(
213217
self.cov
214218
.flatten_to_fixed_depth_cells()
215-
.flat_map(move |idx| HEALPixCell(cov_d, idx).get_children_cells(dd))
219+
.flat_map(move |idx| HEALPixCell(cov_d, idx).get_children_cells(dd)),
216220
)
217221
} else {
218222
Box::new(
219223
degrade((&self.cov.0).into_range_moc_iter(), depth)
220224
.flatten_to_fixed_depth_cells()
221-
.map(move |idx| HEALPixCell(depth, idx))
225+
.map(move |idx| HEALPixCell(depth, idx)),
222226
)
223227
}
224228
}

src/core/src/camera/viewport.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,11 @@ impl CameraViewPort {
233233
self.view_hpx_cells.get_cov(frame)
234234
}
235235

236-
pub fn get_hpx_cells(&self, depth: u8, frame: CooSystem) -> Box<dyn Iterator<Item = HEALPixCell> + '_> {
236+
pub fn get_hpx_cells(
237+
&self,
238+
depth: u8,
239+
frame: CooSystem,
240+
) -> Box<dyn Iterator<Item = HEALPixCell> + '_> {
237241
self.view_hpx_cells.get_cells(depth, frame)
238242
}
239243

src/core/src/downloader/request/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// but contained inside a more specific type of query (e.g. for a tile or allsky)
33
pub mod allsky;
44
pub mod moc;
5-
pub mod tile;
65
pub mod on_resolved;
6+
pub mod tile;
77

88
use wasm_bindgen_futures::JsFuture;
99

@@ -162,6 +162,7 @@ use wasm_bindgen::JsCast;
162162
use web_sys::RequestInit;
163163
use web_sys::RequestMode;
164164
use web_sys::Response;
165+
#[allow(dead_code)]
165166
async fn query_bitmap_from_blob(
166167
url: &str,
167168
mode: RequestMode,
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
/// This stores globally a notifier function that wakes up the JS.
2-
// It ultimately triggers a redraw of the scene.
3-
4-
use std::cell::RefCell;
1+
//! This stores globally a notifier function that wakes up the JS.
2+
//! It ultimately triggers a redraw of the scene.
53
64
thread_local! {
7-
static WAKE_UP_CB: RefCell<Option<js_sys::Function>> = RefCell::new(None);
5+
static WAKE_UP_CB: RefCell<Option<js_sys::Function>> = const { RefCell::new(None) };
86
}
97

108
pub fn set_on_resolved_cb(cb: js_sys::Function) {
119
WAKE_UP_CB.with(|f| *f.borrow_mut() = Some(cb));
1210
}
1311

1412
use crate::JsValue;
13+
use std::cell::RefCell;
1514
pub fn call_on_resolved_cb() {
1615
WAKE_UP_CB.with(|f| {
1716
if let Some(cb) = f.borrow().as_ref() {
1817
let _ = cb.call0(&JsValue::NULL);
1918
}
2019
});
21-
}
20+
}

src/core/src/downloader/request/tile.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use al_core::image::ImageType;
88
use super::super::query::CellDesc;
99
use super::Url;
1010
use super::{Request, RequestType};
11-
use crate::downloader::request::query_html_image;
1211
use crate::downloader::request::query_blob;
12+
use crate::downloader::request::query_html_image;
1313
use crate::downloader::QueryId;
1414

1515
pub struct TileRequest {
@@ -28,7 +28,6 @@ impl From<TileRequest> for RequestType {
2828
}
2929
}
3030

31-
use al_core::image::bitmap::Bitmap;
3231
use al_core::image::html::HTMLImage;
3332
use wasm_bindgen::JsCast;
3433
use wasm_bindgen::JsValue;
@@ -74,10 +73,7 @@ impl From<query::Tile> for TileRequest {
7473
})*/
7574
let blob = query_blob(&url_clone, mode, credentials).await?;
7675

77-
Ok(ImageType::Blob {
78-
blob,
79-
size
80-
})
76+
Ok(ImageType::Blob { blob, size })
8177
} else {
8278
// HTMLImageElement
8379
let image = query_html_image(&url_clone, credentials).await?;
@@ -97,10 +93,7 @@ impl From<query::Tile> for TileRequest {
9793
})*/
9894
let blob = query_blob(&url_clone, mode, credentials).await?;
9995

100-
Ok(ImageType::Blob {
101-
blob,
102-
size
103-
})
96+
Ok(ImageType::Blob { blob, size })
10497
} else {
10598
// HTMLImageElement
10699
let image = query_html_image(&url_clone, credentials).await?;

src/core/src/lib.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ mod utils;
8686

8787
pub mod worker;
8888

89-
9089
use math::projection::*;
9190

9291
//use votable::votable::VOTableWrapper;
@@ -207,17 +206,20 @@ impl WebClient {
207206
}
208207

209208
#[wasm_bindgen(js_name = poll)]
210-
pub fn poll(&mut self, dt: f64, pan: Option<Box<[f64]>>, zoom: Option<f64>) -> Result<PollInfo, JsValue> {
209+
pub fn poll(
210+
&mut self,
211+
dt: f64,
212+
pan: Option<Box<[f64]>>,
213+
zoom: Option<f64>,
214+
) -> Result<PollInfo, JsValue> {
211215
// dt refers to the time taking (in ms) rendering the previous frame
212216
//self.dt = DeltaTime::from_millis(dt as f32);
213217

214218
// Update the application and get back the
215219
// world coordinates of the center of projection in (ra, dec)
216220
self.app.poll(
217221
// Time of the previous frame rendering
218-
dt,
219-
pan,
220-
zoom
222+
dt, pan, zoom,
221223
)
222224
}
223225

@@ -371,11 +373,7 @@ impl WebClient {
371373
}
372374

373375
#[wasm_bindgen(js_name = isHDUVisible)]
374-
pub fn is_hdu_visible(
375-
&self,
376-
layer: String,
377-
hdu_id: usize,
378-
) -> Result<bool, JsValue> {
376+
pub fn is_hdu_visible(&self, layer: String, hdu_id: usize) -> Result<bool, JsValue> {
379377
self.app.is_hdu_visible(layer.as_str(), hdu_id)
380378
}
381379

@@ -386,7 +384,7 @@ impl WebClient {
386384
hdu_id: usize,
387385
visible: bool,
388386
) -> Result<(), JsValue> {
389-
self.app.make_hdu_visible(layer.as_str(), hdu_id, visible)
387+
self.app.make_hdu_visible(layer.as_str(), hdu_id, visible)
390388
}
391389

392390
#[wasm_bindgen(js_name = addRGBAImage)]

0 commit comments

Comments
 (0)