Skip to content

Commit

Permalink
Fix clippy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkdp committed Apr 2, 2023
1 parent 9c4c7f1 commit 4bb5630
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/binocle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ impl Binocle {

for (i, pixel) in frame.chunks_exact_mut(4).enumerate() {
let zoom_factor = settings.zoom_factor();
let x = (((i as isize) % WIDTH as isize) as isize) / zoom_factor;
let y = (((i as isize) / WIDTH as isize) as isize) / zoom_factor;
let x = ((i as isize) % WIDTH as isize) / zoom_factor;
let y = ((i as isize) / WIDTH as isize) / zoom_factor;

let color = if x >= settings.width {
[0, 0, 0, 0]
Expand Down
12 changes: 4 additions & 8 deletions src/datatype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,10 @@ impl Datatype {
.ok()
.map(|bytes| i64::from_be_bytes(bytes) as f32),

(Datatype::Float32, Endianness::Little) => slice
.try_into()
.ok()
.map(|bytes| f32::from_le_bytes(bytes) as f32),
(Datatype::Float32, Endianness::Big) => slice
.try_into()
.ok()
.map(|bytes| f32::from_be_bytes(bytes) as f32),
(Datatype::Float32, Endianness::Little) => {
slice.try_into().ok().map(f32::from_le_bytes)
}
(Datatype::Float32, Endianness::Big) => slice.try_into().ok().map(f32::from_be_bytes),

(Datatype::Float64, Endianness::Little) => slice
.try_into()
Expand Down
2 changes: 1 addition & 1 deletion src/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub fn run(options: CliOptions) -> Result<()> {
let window = {
let size = LogicalSize::new(WIDTH as f64, HEIGHT as f64);
WindowBuilder::new()
.with_title(&format!(
.with_title(format!(
"binocle - {}",
Path::new(&options.filename)
.file_name()
Expand Down

0 comments on commit 4bb5630

Please sign in to comment.