Replace a diverging match with an if let
This commit is contained in:
parent
ee2d7d1b67
commit
5f866737a8
|
|
@ -148,14 +148,13 @@ fn draw_ray_2(gc: &mut Vec<Draw>, space: &Space, base: Vec2, dir: Vec2) {
|
||||||
hits.line_to(pos2.x + 1.0, pos2.y - 1.0);
|
hits.line_to(pos2.x + 1.0, pos2.y - 1.0);
|
||||||
}
|
}
|
||||||
let a = ray.pos;
|
let a = ray.pos;
|
||||||
ray = match ret.end {
|
if let Some(r) = ret.end {
|
||||||
Some(r) => r,
|
ray = r
|
||||||
None => {
|
} else {
|
||||||
ray = ray.forward(1000.0 / DT);
|
ray = ray.forward(1000.0 / DT);
|
||||||
gc.line_to(ray.pos.x, ray.pos.y);
|
gc.line_to(ray.pos.x, ray.pos.y);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
for p in space.line(a, ray.pos, 10.0) {
|
for p in space.line(a, ray.pos, 10.0) {
|
||||||
gc.line_to(p.x, p.y);
|
gc.line_to(p.x, p.y);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user