thk U clippy

This commit is contained in:
Michael Zhang 2021-01-10 03:15:55 -06:00
parent 961e141bfc
commit 695fcd5d85
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
4 changed files with 23 additions and 24 deletions

View file

@ -25,3 +25,6 @@ structopt = "0.3.21"
[dependencies.libosu]
git = "https://github.com/iptq/libosu"
rev = "557d0a321405516f12c3939c1207c7341f796f35"
[features]
clippy = []

View file

@ -90,7 +90,7 @@ impl Game {
self.beatmap = BeatmapExt::new(beatmap);
self.beatmap.compute_stacking();
if self.beatmap.inner.colors.len() > 0 {
if !self.beatmap.inner.colors.is_empty() {
self.combo_colors.clear();
self.combo_colors = self
.beatmap
@ -224,7 +224,7 @@ impl Game {
let mut control_points = vec![ho.inner.pos];
control_points.extend(&info.control_points);
let mut color = color.clone();
let mut color = color;
color.a = 0.6 * draw_info.opacity as f32;
let spline = Game::render_slider(
&mut self.slider_cache,
@ -372,12 +372,10 @@ impl Game {
let frac = diff - beats * tick;
if frac.abs() < 0.0001 {
delta = Some(n as f64 * tick);
} else if n > 0 {
delta = Some((n - 1) as f64 * tick + (tick - frac));
} else {
if n > 0 {
delta = Some((n - 1) as f64 * tick + (tick - frac));
} else {
delta = Some((n - 1) as f64 * tick - frac);
}
delta = Some((n - 1) as f64 * tick - frac);
}
}
if let Some(delta) = delta {
@ -416,13 +414,12 @@ impl EventHandler for Game {
..
}) = &self.current_uninherited_timing_point
{
let steps = -1
* if mods.contains(KeyMods::SHIFT) {
info.meter as i32
} else {
1
};
self.seek_by_steps(steps);
let steps = -if mods.contains(KeyMods::SHIFT) {
info.meter as i32
} else {
1
};
self.seek_by_steps(steps).unwrap();
}
}
Right => {
@ -436,7 +433,7 @@ impl EventHandler for Game {
} else {
1
};
self.seek_by_steps(steps);
self.seek_by_steps(steps).unwrap();
}
}
_ => {}

View file

@ -95,13 +95,16 @@ impl Game {
}
'outer: loop {
for i in 0..last_uninherited.meter as usize {
for (i, (color, height)) in ticks
.iter()
.enumerate()
.take(last_uninherited.meter as usize)
{
let tick_time = time + beat * i as f64 / last_uninherited.meter as f64;
if tick_time > right_limit {
break 'outer;
}
let (color, height) = ticks[i];
let percent =
(tick_time - timeline_left) / (timeline_right - timeline_left);
let x = percent as f32 * BOUNDS.w + BOUNDS.x;
@ -111,7 +114,7 @@ impl Game {
ctx,
&[Point2::new(x, y1), Point2::new(x, y2)],
1.0,
color,
*color,
)?;
graphics::draw(ctx, &tick, DrawParam::default())?;
}

View file

@ -64,12 +64,8 @@ impl Texture {
self.animation.clear();
let mut curr = 0;
loop {
let image = match Image::new(ctx, &format!("/{}{}{}.png", self.name, hyphen, curr))
{
Ok(v) => v,
Err(_) => break,
};
while let Ok(image) = Image::new(ctx, &format!("/{}{}{}.png", self.name, hyphen, curr))
{
self.animation.push(image);
found = true;
curr += 1;