mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Use Rust 2021 postfix .into_iter()
This commit is contained in:
parent
998b1deb15
commit
cf66eccb75
@ -1972,13 +1972,13 @@ fn closest_points(n: LineSegment2<f32>, m: LineSegment2<f32>) -> (Vec2<f32>, Vec
|
||||
|
||||
// Check to see whether the lines are parallel
|
||||
if !t.is_finite() || !u.is_finite() {
|
||||
// TODO: can use postfix .into_iter() when switching to Rust 2021
|
||||
IntoIterator::into_iter([
|
||||
[
|
||||
(n.projected_point(m.start), m.start),
|
||||
(n.projected_point(m.end), m.end),
|
||||
(n.start, m.projected_point(n.start)),
|
||||
(n.end, m.projected_point(n.end)),
|
||||
])
|
||||
]
|
||||
.into_iter()
|
||||
.min_by_key(|(a, b)| ordered_float::OrderedFloat(a.distance_squared(*b)))
|
||||
.expect("Lines had non-finite elements")
|
||||
} else {
|
||||
|
@ -2130,18 +2130,21 @@ impl WorldSim {
|
||||
/// them spawning).
|
||||
pub fn get_near_trees(&self, wpos: Vec2<i32>) -> impl Iterator<Item = TreeAttr> + '_ {
|
||||
// Deterministic based on wpos
|
||||
// TODO: can use postfix .into_iter() when switching to Rust 2021
|
||||
let normal_trees = IntoIterator::into_iter(self.gen_ctx.structure_gen.get(wpos))
|
||||
.filter_map(move |(wpos, seed)| {
|
||||
let lottery = self.make_forest_lottery(wpos);
|
||||
Some(TreeAttr {
|
||||
pos: wpos,
|
||||
seed,
|
||||
scale: 1.0,
|
||||
forest_kind: *lottery.choose_seeded(seed).as_ref()?,
|
||||
inhabited: false,
|
||||
})
|
||||
});
|
||||
let normal_trees =
|
||||
self.gen_ctx
|
||||
.structure_gen
|
||||
.get(wpos)
|
||||
.into_iter()
|
||||
.filter_map(move |(wpos, seed)| {
|
||||
let lottery = self.make_forest_lottery(wpos);
|
||||
Some(TreeAttr {
|
||||
pos: wpos,
|
||||
seed,
|
||||
scale: 1.0,
|
||||
forest_kind: *lottery.choose_seeded(seed).as_ref()?,
|
||||
inhabited: false,
|
||||
})
|
||||
});
|
||||
|
||||
// // For testing
|
||||
// let giant_trees =
|
||||
|
Loading…
Reference in New Issue
Block a user