rust 2018: run the new fmt, delete the unneeded script

This commit is contained in:
Dustin Carlino 2018-12-06 10:05:42 -08:00
parent dc450a1959
commit 6a0cd7f71e
45 changed files with 221 additions and 150 deletions

View File

@ -35,7 +35,8 @@ impl WeightedUsizeChoice {
.map(|(idx, pr)| Weighted {
weight: *pr,
item: idx as u32,
}).collect();
})
.collect();
WeightedChoice::new(&mut items).sample(rng)
}
}

View File

@ -89,8 +89,8 @@ pub fn convert(flags: &Flags, timer: &mut abstutil::Timer) -> raw_data::Map {
parcels.shapes.len()
);
for p in parcels.shapes.into_iter() {
if p.points.len() > 1 && p
.points
if p.points.len() > 1
&& p.points
.iter()
.find(|pt| !gps_bounds.contains(**pt))
.is_none()

View File

@ -7,23 +7,27 @@ pub fn convert(geojson_path: &str, map_name: String, gps_bounds: &GPSBounds) {
println!("Extracting neighborhoods from {}...", geojson_path);
let document: GeoJson = abstutil::read_json(geojson_path).unwrap();
match document {
GeoJson::FeatureCollection(c) => for f in c.features.into_iter() {
GeoJson::FeatureCollection(c) => {
for f in c.features.into_iter() {
let name = f.properties.unwrap()["name"].as_str().unwrap().to_string();
match f.geometry.unwrap().value {
Value::Polygon(p) => {
convert_polygon(p, name, map_name.clone(), gps_bounds);
}
Value::MultiPolygon(polygons) => for (idx, p) in polygons.into_iter().enumerate() {
Value::MultiPolygon(polygons) => {
for (idx, p) in polygons.into_iter().enumerate() {
convert_polygon(
p,
format!("{} portion #{}", name, idx + 1),
map_name.clone(),
gps_bounds,
);
},
}
}
x => panic!("Unexpected GeoJson value {:?}", x),
}
},
}
}
_ => panic!("Unexpected GeoJson root {:?}", document),
}
}
@ -52,5 +56,6 @@ fn convert_polygon(input: PolygonType, name: String, map_name: String, gps_bound
map_name: map_name,
name,
points,
}.save();
}
.save();
}

View File

@ -58,11 +58,13 @@ impl Plugin for OsmClassifier {
None
}
}
ID::Building(b) => if ctx.map.get_b(b).osm_tags.contains_key("addr:housenumber") {
ID::Building(b) => {
if ctx.map.get_b(b).osm_tags.contains_key("addr:housenumber") {
Some(ctx.cs.get("OSM house", Color::GREEN))
} else {
None
},
}
}
_ => None,
}
}

View File

@ -13,11 +13,11 @@ pub enum ABTestManager {
impl ABTestManager {
pub fn new(ctx: &mut PluginCtx) -> Option<ABTestManager> {
if ctx.primary.current_selection.is_none() && ctx.input.unimportant_key_pressed(
Key::B,
SIM_SETUP,
"manage A/B tests",
) {
if ctx.primary.current_selection.is_none()
&& ctx
.input
.unimportant_key_pressed(Key::B, SIM_SETUP, "manage A/B tests")
{
return Some(ABTestManager::PickABTest(Wizard::new()));
}
None

View File

@ -34,7 +34,8 @@ impl Plugin for EditsManager {
ctx.kml,
&mut new_primary,
self.wizard.wrap(ctx.input),
).is_some()
)
.is_some()
{
// TODO NLL makes this easier
true

View File

@ -7,11 +7,11 @@ pub struct RoadEditor {}
impl RoadEditor {
pub fn new(ctx: &mut PluginCtx) -> Option<RoadEditor> {
if ctx.primary.current_selection.is_none() && ctx.input.unimportant_key_pressed(
Key::E,
EDIT_MAP,
"Start editing roads",
) {
if ctx.primary.current_selection.is_none()
&& ctx
.input
.unimportant_key_pressed(Key::E, EDIT_MAP, "Start editing roads")
{
return Some(RoadEditor {});
}
None

View File

@ -12,7 +12,8 @@ pub struct StopSignEditor {
impl StopSignEditor {
pub fn new(ctx: &mut PluginCtx) -> Option<StopSignEditor> {
if let Some(ID::Intersection(id)) = ctx.primary.current_selection {
if ctx.primary.map.maybe_get_stop_sign(id).is_some() && ctx
if ctx.primary.map.maybe_get_stop_sign(id).is_some()
&& ctx
.input
.key_pressed(Key::E, &format!("edit stop signs for {}", id))
{
@ -40,11 +41,13 @@ impl Plugin for StopSignEditor {
let next_priority = match sign.get_priority(id) {
TurnPriority::Banned => TurnPriority::Stop,
TurnPriority::Stop => TurnPriority::Yield,
TurnPriority::Yield => if sign.could_be_priority_turn(id, map) {
TurnPriority::Yield => {
if sign.could_be_priority_turn(id, map) {
TurnPriority::Priority
} else {
TurnPriority::Banned
},
}
}
TurnPriority::Priority => TurnPriority::Banned,
};
if input.key_pressed(Key::Space, &format!("toggle to {:?}", next_priority)) {

View File

@ -22,7 +22,8 @@ pub struct TrafficSignalEditor {
impl TrafficSignalEditor {
pub fn new(ctx: &mut PluginCtx) -> Option<TrafficSignalEditor> {
if let Some(ID::Intersection(id)) = ctx.primary.current_selection {
if ctx.primary.map.maybe_get_traffic_signal(id).is_some() && ctx
if ctx.primary.map.maybe_get_traffic_signal(id).is_some()
&& ctx
.input
.key_pressed(Key::E, &format!("edit traffic signal for {}", id))
{
@ -75,7 +76,8 @@ impl Plugin for TrafficSignalEditor {
.duration
.value_unsafe as usize
),
) {
)
{
let mut signal = ctx.primary.map.get_traffic_signal(self.i).clone();
signal.cycles[self.current_cycle].edit_duration((new_duration as f64) * si::S);
ctx.primary.map.edit_traffic_signal(signal);
@ -348,5 +350,6 @@ fn choose_preset(
.choose_something::<ControlTrafficSignal>(
"Use which preset for this intersection?",
Box::new(move || choices.clone()),
).map(|(_, ts)| ts)
)
.map(|(_, ts)| ts)
}

View File

@ -53,7 +53,8 @@ pub fn choose_neighborhood(map: &Map, wizard: &mut WrappedWizard, query: &str) -
.choose_something::<Neighborhood>(
query,
Box::new(move || Neighborhood::load_all(&map_name, &gps_bounds)),
).map(|(n, _)| n)
)
.map(|(n, _)| n)
}
pub fn load_neighborhood_builder(
@ -66,7 +67,8 @@ pub fn load_neighborhood_builder(
.choose_something::<NeighborhoodBuilder>(
query,
Box::new(move || abstutil::load_all_objects("neighborhoods", &map_name)),
).map(|(_, n)| n)
)
.map(|(_, n)| n)
}
pub fn load_scenario(map: &Map, wizard: &mut WrappedWizard, query: &str) -> Option<Scenario> {
@ -75,7 +77,8 @@ pub fn load_scenario(map: &Map, wizard: &mut WrappedWizard, query: &str) -> Opti
.choose_something::<Scenario>(
query,
Box::new(move || abstutil::load_all_objects("scenarios", &map_name)),
).map(|(_, s)| s)
)
.map(|(_, s)| s)
}
pub fn choose_scenario(map: &Map, wizard: &mut WrappedWizard, query: &str) -> Option<String> {
@ -84,7 +87,8 @@ pub fn choose_scenario(map: &Map, wizard: &mut WrappedWizard, query: &str) -> Op
.choose_something::<String>(
query,
Box::new(move || abstutil::list_all_objects("scenarios", &map_name)),
).map(|(n, _)| n)
)
.map(|(n, _)| n)
}
// TODO Implicitly need a blank edits entry
@ -94,7 +98,8 @@ pub fn choose_edits(map: &Map, wizard: &mut WrappedWizard, query: &str) -> Optio
.choose_something::<String>(
query,
Box::new(move || abstutil::list_all_objects("edits", &map_name)),
).map(|(n, _)| n)
)
.map(|(n, _)| n)
}
pub fn load_ab_test(map: &Map, wizard: &mut WrappedWizard, query: &str) -> Option<ABTest> {
@ -103,7 +108,8 @@ pub fn load_ab_test(map: &Map, wizard: &mut WrappedWizard, query: &str) -> Optio
.choose_something::<ABTest>(
query,
Box::new(move || abstutil::load_all_objects("ab_tests", &map_name)),
).map(|(_, t)| t)
)
.map(|(_, t)| t)
}
pub fn input_tick(wizard: &mut WrappedWizard, query: &str) -> Option<Tick> {

View File

@ -26,7 +26,8 @@ impl NeighborhoodSummary {
.map(|(idx, (_, n))| {
timer.next();
Region::new(idx, n, map, draw_map)
}).collect(),
})
.collect(),
active: false,
last_summary: None,
}
@ -43,7 +44,8 @@ impl Plugin for NeighborhoodSummary {
self.active = false;
}
} else {
self.active = ctx.primary.current_selection.is_none() && ctx
self.active = ctx.primary.current_selection.is_none()
&& ctx
.input
.unimportant_key_pressed(Key::Z, DEBUG, "show neighborhood summaries");
}
@ -96,7 +98,8 @@ impl Region {
} else {
None
}
}).collect();
})
.collect();
let mut summary = Text::new();
summary.add_line(format!("{} - no summary yet", n.name));
Region {

View File

@ -85,18 +85,23 @@ impl Plugin for TurnCyclerState {
ctx.cs.get("current selected turn", Color::RED),
);
}
None => for turn in &relevant_turns {
None => {
for turn in &relevant_turns {
let color = match turn.turn_type {
TurnType::SharedSidewalkCorner => {
ctx.cs.get("shared sidewalk corner turn", Color::BLACK)
}
TurnType::Crosswalk => ctx.cs.get("crosswalk turn", Color::WHITE),
TurnType::Crosswalk => {
ctx.cs.get("crosswalk turn", Color::WHITE)
}
TurnType::Straight => ctx.cs.get("straight turn", Color::BLUE),
TurnType::Right => ctx.cs.get("right turn", Color::GREEN),
TurnType::Left => ctx.cs.get("left turn", Color::RED),
}.alpha(0.5);
}
.alpha(0.5);
DrawTurn::draw_full(turn, g, color);
},
}
}
}
}
}

View File

@ -26,7 +26,8 @@ impl DrawBusStop {
lane.safe_dist_along(stop.sidewalk_pos.dist_along() + radius)
.map(|(pt, _)| pt)
.unwrap_or(lane.last_pt()),
]).make_polygons_blindly(0.8 * LANE_THICKNESS);
])
.make_polygons_blindly(0.8 * LANE_THICKNESS);
DrawBusStop {
id: stop.id,
polygon,

View File

@ -70,7 +70,8 @@ impl DrawCar {
.project_away(
input.vehicle_length.value_unsafe - 1.0,
input.angle.opposite(),
).project_away(
)
.project_away(
CAR_WIDTH / 2.0 - front_window_length_gap,
input.angle.rotate_degs(-90.0),
),

View File

@ -68,7 +68,8 @@ impl DrawMap {
.map(|b| {
timer.next();
DrawBuilding::new(b)
}).collect();
})
.collect();
let parcels: Vec<DrawParcel> = map
.all_parcels()
.iter()

View File

@ -284,7 +284,8 @@ impl UI {
&ui.primary.sim,
&ui.primary.draw_map,
)
}).expect("Can't get canonical_point of BuildingID(0) or Road(0)");
})
.expect("Can't get canonical_point of BuildingID(0) or Road(0)");
ui.canvas.center_on_map_pt(focus_pt);
}
}

View File

@ -36,7 +36,8 @@ pub fn run<T, G: GUI<T>>(mut gui: G, window_title: &str, initial_width: u32, ini
"/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",
(),
texture_settings,
).expect("Could not load font");
)
.expect("Could not load font");
let mut last_event_mode = EventLoopMode::InputOnly;
while let Some(ev) = events.next(&mut window) {

7
fmt.sh
View File

@ -1,7 +0,0 @@
#!/bin/bash
for x in `find */src */tests | grep '.rs$' | xargs`; do
~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustfmt $x;
done
rm */src/*.bk -f;
rm */src/*/*.bk -f;

View File

@ -88,7 +88,8 @@ impl Line {
if res_len != dist_along {
println!("whats the delta btwn {} and {}?", res_len, dist_along);
}
*/ }
*/
}
pub fn unbounded_dist_along(&self, dist: si::Meter<f64>) -> Pt2D {
let len = self.length();
@ -103,7 +104,8 @@ impl Line {
if res_len != dist_along {
println!("whats the delta btwn {} and {}?", res_len, dist_along);
}
*/ }
*/
}
pub fn contains_pt(&self, pt: Pt2D) -> bool {
let dist = Line(self.0, pt).length() + Line(pt, self.1).length() - self.length();

View File

@ -113,7 +113,8 @@ impl Polygon {
t.pt2.offset(dx, dy),
t.pt3.offset(dx, dy),
)
}).collect(),
})
.collect(),
}
}

View File

@ -447,15 +447,18 @@ fn shift_polyline_equivalence() {
let pt2_s = line_intersection(
&Line::new(pt1, pt2).shift(width),
&Line::new(pt2, pt3).shift(width),
).unwrap();
)
.unwrap();
let pt3_s = line_intersection(
&Line::new(pt2, pt3).shift(width),
&Line::new(pt3, pt4).shift(width),
).unwrap();
)
.unwrap();
let pt4_s = line_intersection(
&Line::new(pt3, pt4).shift(width),
&Line::new(pt4, pt5).shift(width),
).unwrap();
)
.unwrap();
let pt5_s = Line::new(pt4, pt5).shift(width).pt2();
assert_eq!(

View File

@ -41,7 +41,8 @@ impl UI {
&flags.load_map,
MapEdits::new("map name"),
&mut Timer::new("load map for Halloween"),
).unwrap();
)
.unwrap();
UI {
canvas: Canvas::new(),
draw_map: DrawMap::new(map),

View File

@ -62,7 +62,8 @@ where
} else {
None
}
}).min_by_key(|(_, _, dist)| *dist)
})
.min_by_key(|(_, _, dist)| *dist)
.map(|(key, pt, _)| (key.clone(), Pt2D::new(pt.x(), pt.y())))
}

View File

@ -132,7 +132,8 @@ pub fn verify_bus_routes(map: &Map, routes: Vec<BusRoute>, timer: &mut Timer) ->
can_use_bike_lanes: false,
can_use_bus_lanes: true,
},
).is_none()
)
.is_none()
{
warn!(
"Removing route {} since {:?} and {:?} aren't connected",
@ -143,5 +144,6 @@ pub fn verify_bus_routes(map: &Map, routes: Vec<BusRoute>, timer: &mut Timer) ->
}
}
ok
}).collect()
})
.collect()
}

View File

@ -34,7 +34,8 @@ pub fn intersection_polygon(i: &Intersection, roads: &Vec<Road>) -> Vec<Pt2D> {
let pl_normal = line.shift(width_normal).unwrap();
let pl_reverse = line.reversed().shift(width_reverse).unwrap().reversed();
(*id, line.last_line().angle(), pl_normal, pl_reverse)
}).collect();
})
.collect();
// Sort the polylines by the angle of their last segment.
// TODO This might break weirdly for polylines with very short last lines!
@ -74,7 +75,8 @@ pub fn intersection_polygon(i: &Intersection, roads: &Vec<Road>) -> Vec<Pt2D> {
l.reversed()
.safe_dist_along(DEGENERATE_INTERSECTION_HALF_LENGTH)
.map(|(pt, _)| pt)
}).collect::<Vec<Pt2D>>(),
})
.collect::<Vec<Pt2D>>(),
);
if endpoints.len() != 4 {
error!("{} has only {} and {}, some of which are too short to make degenerate intersection geometry", i.id, id1, id2);
@ -97,7 +99,8 @@ pub fn intersection_polygon(i: &Intersection, roads: &Vec<Road>) -> Vec<Pt2D> {
// If the two lines are too close in angle, they'll either not hit or even if they do, it
// won't be right.
let angle_diff = (pl1.last_line().angle().opposite().normalized_degrees()
- pl2.last_line().angle().normalized_degrees()).abs();
- pl2.last_line().angle().normalized_degrees())
.abs();
// TODO A tuning challenge. :)
if angle_diff > 15.0 {

View File

@ -40,7 +40,8 @@ fn get_lanes(r: &raw_data::Road) -> (Vec<LaneType>, Vec<LaneType>) {
} else {
// TODO OSM way 124940792 is I5 express lane, should it be considered oneway?
(num_driving_lanes_per_road / 2).max(1)
}).collect();
})
.collect();
// TODO Don't even bother trying to parse this yet.
let has_bus_lane = r.osm_tags.contains_key("bus:lanes");
// TODO This is circumstantial at best. :)

View File

@ -204,7 +204,8 @@ fn make_walking_turns(i: &Intersection, map: &Map) -> Vec<Turn> {
r.id, i.id
);
}
}).collect();
})
.collect();
roads.sort_by_key(|(_, angle)| angle.normalized_degrees() as i64);
let mut result: Vec<Turn> = Vec::new();

View File

@ -263,7 +263,8 @@ impl Pathfinder {
can_use_bike_lanes: req.can_use_bike_lanes,
can_use_bus_lanes: req.can_use_bus_lanes,
can_use_transit: false,
}.pathfind(map, req.start, req.end)?;
}
.pathfind(map, req.start, req.end)?;
let steps: Vec<PathStep> = internal_steps
.into_iter()
.map(|s| match s {
@ -273,7 +274,8 @@ impl Pathfinder {
InternalPathStep::RideBus(_, _, _) => {
panic!("shortest_distance pathfind had {:?} as a step", s)
}
}).collect();
})
.collect();
assert_eq!(
steps[0].as_traversable(),
Traversable::Lane(req.start.lane())
@ -299,7 +301,8 @@ impl Pathfinder {
can_use_bike_lanes: false,
can_use_bus_lanes: false,
can_use_transit: true,
}.pathfind(map, start, goal)?;
}
.pathfind(map, start, goal)?;
for s in internal_steps.into_iter() {
if let InternalPathStep::RideBus(stop1, stop2, route) = s {
return Some((stop1, stop2, route));

View File

@ -76,7 +76,8 @@ impl ControlStopSign {
} else {
None
}
}).collect();
})
.collect();
for t1 in &priority_turns {
for t2 in &priority_turns {
if map.get_t(*t1).conflicts_with(map.get_t(*t2)) {

View File

@ -17,7 +17,8 @@ pub fn run(g: &mut GfxCtx, labels: &mut Vec<(Pt2D, String)>) {
Pt2D::new(2620.4658232463926, 1163.9861244298272),
Pt2D::new(2610.979416102837, 1164.2392149291984),
//Pt2D::new(2572.5481805300115, 1164.2059309889344),
].iter()
]
.iter()
.map(|pt| Pt2D::new(pt.x() - 2500.0, pt.y() - 1000.0))
.collect(),
);

View File

@ -10,7 +10,8 @@ pub fn run(g: &mut GfxCtx) {
Pt2D::new(1341.8334675664184, 388.5049183955915),
Pt2D::new(1343.4401359706367, 378.05011956849677),
Pt2D::new(1344.2823018114202, 367.36774792310285),
]).reversed();
])
.reversed();
let mut horiz_pl = PolyLine::new(vec![
Pt2D::new(1388.995635038006, 411.7906956729764),
Pt2D::new(1327.388582742321, 410.78740100896965),

View File

@ -719,7 +719,8 @@ impl DrivingSimState {
&params.vehicle,
start_dist - other_dist - params.vehicle.length,
0.0 * si::MPS,
).unwrap();
)
.unwrap();
if accel_for_other_to_stop <= other_vehicle.max_deaccel {
//debug!("{} can't spawn {} in front of {}, because {} would have to do {} to not hit {}", params.car, params.dist_along - other_dist, other, other, accel_for_other_to_stop, params.car);
return false;

View File

@ -109,7 +109,8 @@ impl Sim {
start_from_border: i.id,
goal: OriginDestination::Neighborhood("_everywhere_".to_string()),
percent_use_transit: 0.5,
}).collect(),
})
.collect(),
};
for i in map.all_outgoing_borders() {
s.spawn_over_time.push(SpawnOverTime {

View File

@ -241,7 +241,8 @@ impl StopSign {
.find(|req| {
base_t.conflicts_with(map.get_t(req.turn))
&& ss.get_priority(req.turn) > base_priority
}).is_some()
})
.is_some()
}
fn step(&mut self, events: &mut Vec<Event>, time: Tick, map: &Map, view: &WorldView) {
@ -352,7 +353,8 @@ impl TrafficSignal {
} else {
None
}
}).collect();
})
.collect();
let mut keep_requests: BTreeSet<Request> = BTreeSet::new();
for req in self.requests.iter() {

View File

@ -58,14 +58,16 @@ pub fn load(
abstutil::read_json(&format!(
"../data/edits/{}/{}.json",
sim.map_name, sim.edits_name
)).unwrap()
))
.unwrap()
};
// Try loading the pre-baked map first
let map: Map = abstutil::read_binary(
&format!("../data/maps/{}_{}.abst", sim.map_name, sim.edits_name),
timer,
).unwrap_or_else(|_| {
)
.unwrap_or_else(|_| {
let map_path = format!("../data/raw_maps/{}.abst", sim.map_name);
Map::new(&map_path, edits, timer)
.expect(&format!("Couldn't load map from {}", map_path))
@ -84,7 +86,8 @@ pub fn load(
scenario.map_name, edits.edits_name
),
timer,
).unwrap_or_else(|_| {
)
.unwrap_or_else(|_| {
let map_path = format!("../data/raw_maps/{}.abst", scenario.map_name);
Map::new(&map_path, edits, timer)
.expect(&format!("Couldn't load map from {}", map_path))
@ -141,6 +144,7 @@ fn load_edits(map_name: &str, flags: &SimFlags) -> MapEdits {
let edits: MapEdits = abstutil::read_json(&format!(
"../data/edits/{}/{}.json",
map_name, flags.edits_name
)).unwrap();
))
.unwrap();
edits
}

View File

@ -27,7 +27,8 @@ impl NeighborhoodBuilder {
.map(|pt| {
Pt2D::from_gps(*pt, gps_bounds)
.expect(&format!("Polygon {} has bad pt {}", self.name, pt))
}).collect(),
})
.collect(),
),
}
}

View File

@ -76,7 +76,8 @@ impl ParkingSimState {
} else {
None
}
}).collect()
})
.collect()
}
pub fn get_draw_car(&self, id: CarID) -> Option<DrawCarInput> {
@ -211,7 +212,8 @@ impl ParkingLane {
pos,
angle,
}
}).collect(),
})
.collect(),
}
}

View File

@ -85,7 +85,8 @@ impl Command {
.find_closest_lane(
start_sidewalk.lane(),
vec![LaneType::Driving, LaneType::Biking],
).unwrap();
)
.unwrap();
let start = start_sidewalk.equiv_pos(start_lane, map);
let end = match goal {
DrivingGoal::ParkNear(b) => find_biking_goal_near_building(*b, map),

View File

@ -102,12 +102,14 @@ impl TransitSimState {
can_use_bike_lanes: false,
can_use_bus_lanes: true,
},
).expect(&format!(
)
.expect(&format!(
"No route between bus stops {:?} and {:?}",
stop1, stop2
));
(next_stop, stop1.driving_pos.dist_along(), path)
}).collect()
})
.collect()
}
pub fn bus_created(&mut self, bus: CarID, route: BusRouteID, next_stop_idx: StopIdx) {
@ -173,7 +175,8 @@ impl TransitSimState {
can_use_bike_lanes: false,
can_use_bus_lanes: true,
},
).expect(&format!(
)
.expect(&format!(
"No route between bus stops {:?} and {:?}",
stop, route.stops[next_stop]
));

View File

@ -214,7 +214,8 @@ impl TripManager {
TripLeg::DriveFromBorder(_, _) => true,
TripLeg::ServeBusRoute(_, _) => true,
_ => false,
}).is_some(),
})
.is_some(),
legs: VecDeque::from(legs),
});
id

View File

@ -569,7 +569,8 @@ impl WalkingSimState {
waiting_for_turn: ped.waiting_for_turn(),
preparing_bike: ped.bike_parking.is_some(),
on: ped.on,
}).collect()
})
.collect()
}
pub fn seed_pedestrian(

View File

@ -37,12 +37,14 @@ pub fn run(t: &mut TestRunner) {
"../data/raw_maps/montlake.abst",
map_model::MapEdits::new("montlake"),
&mut abstutil::Timer::new("raw to map"),
).unwrap();
)
.unwrap();
let map2 = map_model::Map::new(
"../data/raw_maps/montlake.abst",
map_model::MapEdits::new("montlake"),
&mut abstutil::Timer::new("raw to map"),
).unwrap();
)
.unwrap();
if abstutil::to_json(&map1) != abstutil::to_json(&map2) {
// TODO tmp files

View File

@ -151,18 +151,21 @@ impl TestRunner {
.append(true)
.open(output_path.clone())
.unwrap(),
).unwrap();
)
.unwrap();
let _stderr_redirect = Redirect::stderr(
std::fs::OpenOptions::new()
.create(true)
.append(true)
.open(output_path.clone())
.unwrap(),
).unwrap();
)
.unwrap();
std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
test(&mut helper);
})).is_ok()
}))
.is_ok()
};
if pass && !self.flags.keep_output {

View File

@ -13,7 +13,7 @@ type DepthFormat = gfx::format::DepthStencil;
const BLACK: [f32; 4] = [0.0, 0.0, 0.0, 1.0];
gfx_defines!{
gfx_defines! {
vertex GpuFillVertex {
position: [f32; 2] = "a_position",
}
@ -49,7 +49,8 @@ fn main() {
gfx::Primitive::TriangleList,
gfx::state::Rasterizer::new_fill(),
fill_pipeline::new(),
).unwrap();
)
.unwrap();
// The geometry!
let vertices = vec![