Skip to content

Commit dc411f4

Browse files
committed
improve formatting
1 parent 49130a7 commit dc411f4

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

src/main.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ mod grid;
33
mod renderer;
44
mod simulation;
55

6-
use cli::Args;
76
use clap::Parser;
7+
use cli::Args;
88
use grid::Grid;
99
use renderer::render;
1010
use simulation::{Metaball, update_balls, update_grid};
@@ -24,7 +24,6 @@ use rand::{RngExt, rng};
2424

2525
use crossterm::cursor::{Hide, Show};
2626

27-
2827
fn main() -> std::io::Result<()> {
2928
let args = Args::parse();
3029

@@ -58,12 +57,11 @@ fn main() -> std::io::Result<()> {
5857
loop {
5958
let frame_start = Instant::now();
6059

61-
if poll(Duration::from_millis(1))? {
62-
if let Event::Key(key) = read()? {
63-
if key.code == KeyCode::Char('q') {
64-
break;
65-
}
66-
}
60+
if poll(Duration::from_millis(1))?
61+
&& let Event::Key(key) = read()?
62+
&& key.code == KeyCode::Char('q')
63+
{
64+
break;
6765
}
6866

6967
time += 0.03;

src/renderer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ pub fn render(grid: &Grid, time: f32, stdout: &mut impl Write) -> std::io::Resul
2525
for x in 0..grid.width {
2626
let sin_x = (x as f32 * 0.12 + time).sin();
2727
let top = grid.get(x, y) + (sin_x + (y as f32 * 0.15 + time * 1.3).cos()) * 0.15;
28-
let bottom = grid.get(x, y + 1)
29-
+ (sin_x + ((y + 1) as f32 * 0.15 + time * 1.3).cos()) * 0.15;
28+
let bottom =
29+
grid.get(x, y + 1) + (sin_x + ((y + 1) as f32 * 0.15 + time * 1.3).cos()) * 0.15;
3030

3131
queue!(
3232
stdout,

0 commit comments

Comments
 (0)