mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-28 03:35:51 +03:00
round of clippy / unbreaking the build
This commit is contained in:
parent
bad4ea7039
commit
35b3e4b7be
@ -6,11 +6,13 @@ touch `find * | grep '\.rs' | grep -v target | xargs`
|
||||
# TODO Remove all of these exceptions
|
||||
# TODO Report issues for some of these false positives
|
||||
cargo clippy -- \
|
||||
-A clippy::block_in_if_condition_stmt \
|
||||
-A clippy::collapsible_if \
|
||||
-A clippy::cyclomatic_complexity \
|
||||
-A clippy::expect_fun_call \
|
||||
-A clippy::float_cmp \
|
||||
-A clippy::if_same_then_else \
|
||||
-A clippy::len_without_is_empty \
|
||||
-A clippy::large_enum_variant \
|
||||
-A clippy::many_single_char_names \
|
||||
-A clippy::map_entry \
|
||||
|
@ -122,8 +122,14 @@ fn use_parking_hints(
|
||||
FindClosest::new(&gps_bounds.to_bounds());
|
||||
for (id, r) in &map.roads {
|
||||
let pts = PolyLine::new(gps_bounds.must_convert(&r.points));
|
||||
closest.add((*id, true), &pts.shift_right(LANE_THICKNESS).get(timer));
|
||||
closest.add((*id, false), &pts.shift_left(LANE_THICKNESS).get(timer));
|
||||
closest.add(
|
||||
(*id, true),
|
||||
pts.shift_right(LANE_THICKNESS).get(timer).points(),
|
||||
);
|
||||
closest.add(
|
||||
(*id, false),
|
||||
pts.shift_left(LANE_THICKNESS).get(timer).points(),
|
||||
);
|
||||
}
|
||||
|
||||
'SHAPE: for s in shapes.shapes.into_iter() {
|
||||
|
@ -555,7 +555,7 @@ fn intersection(p1: &Polygon, p2: &Polygon) -> Vec<Polygon> {
|
||||
let mut cp2 = poly_to_cpoly(p2);
|
||||
cp1.intersection(&mut cp2)
|
||||
.into_iter()
|
||||
.map(|pts| cpoly_to_poly(pts))
|
||||
.map(cpoly_to_poly)
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ impl DrawCar {
|
||||
);
|
||||
|
||||
let bg_color = cs.get_def("blinker background", Color::grey(0.2));
|
||||
for c in vec![&front_left, &front_right, &back_left, &back_right] {
|
||||
for c in &[&front_left, &front_right, &back_left, &back_right] {
|
||||
draw_default.push(bg_color, c.to_polygon());
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ impl DrawIntersection {
|
||||
);
|
||||
}
|
||||
IntersectionType::StopSign => {
|
||||
for (_, ss) in &map.get_stop_sign(i.id).roads {
|
||||
for ss in map.get_stop_sign(i.id).roads.values() {
|
||||
if ss.enabled {
|
||||
if let Some((octagon, pole)) = DrawIntersection::stop_sign_geom(ss, map) {
|
||||
default_geom
|
||||
@ -541,7 +541,7 @@ fn make_octagon(center: Pt2D, radius: Distance, facing: Angle) -> Polygon {
|
||||
.map(|i| {
|
||||
center.project_away(
|
||||
radius,
|
||||
facing + Angle::new_degs(22.5 + (i * 360 / 8) as f64),
|
||||
facing + Angle::new_degs(22.5 + f64::from(i * 360 / 8)),
|
||||
)
|
||||
})
|
||||
.collect(),
|
||||
|
@ -64,7 +64,7 @@ impl Event {
|
||||
// Probably the better way is to convert the LogicalPosition to a PhysicalPosition
|
||||
// somehow knowing the DPI.
|
||||
glutin::MouseScrollDelta::PixelDelta(pos) => {
|
||||
Some(Event::MouseWheelScroll(f64::from(0.1 * pos.y)))
|
||||
Some(Event::MouseWheelScroll(0.1 * pos.y))
|
||||
}
|
||||
},
|
||||
glutin::WindowEvent::Resized(size) => {
|
||||
|
@ -105,9 +105,10 @@ impl DrawBuilding {
|
||||
// TODO or modify g's ctx
|
||||
g.draw_polygon(
|
||||
BUILDING,
|
||||
&self
|
||||
.polygon
|
||||
.translate(-1.0 * (1.0 - percent) * dx, -1.0 * (1.0 - percent) * dy),
|
||||
&self.polygon.translate(
|
||||
Distance::meters(-1.0 * (1.0 - percent) * dx),
|
||||
Distance::meters(-1.0 * (1.0 - percent) * dy),
|
||||
),
|
||||
);
|
||||
|
||||
if let Some(new_line) = Line::maybe_new(
|
||||
|
@ -153,7 +153,7 @@ impl TractData {
|
||||
let mut sum = 0;
|
||||
for (name, est) in &self.household_vehicles {
|
||||
match name.as_str() {
|
||||
"1 vehicle avail." => sum += 1 * est.value,
|
||||
"1 vehicle avail." => sum += est.value,
|
||||
"2 vehicles avail." => sum += 2 * est.value,
|
||||
"3 vehicles avail." => sum += 3 * est.value,
|
||||
// Many more than 4 seems unrealistic
|
||||
|
Loading…
Reference in New Issue
Block a user