Skip to content

Commit a4f5970

Browse files
committed
for loops already implicitly call .into_iter()
I'm surprised I caught this myself instead of Clippy yelling about it! (Clippy contribution opportunity??)
1 parent c60c007 commit a4f5970

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/life.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ impl WorldState {
448448
}
449449

450450
pub fn occupying_affiliated_agent(&self, at: Locale, team: Team) -> Option<Agent> {
451-
for agent in Agent::dramatis_personæ(team).into_iter() {
451+
for agent in Agent::dramatis_personæ(team) {
452452
if self.agent_to_pinfield_ref(agent).query(at) {
453453
return Some(agent);
454454
}
@@ -642,7 +642,7 @@ impl WorldState {
642642
let servant_agent = Agent::new(team, JobDescription::Servant);
643643
let positional_chart: &Pinfield = self.agent_to_pinfield_ref(servant_agent);
644644
let mut premonitions = Vec::new();
645-
for start_locale in positional_chart.to_locales().into_iter() {
645+
for start_locale in positional_chart.to_locales() {
646646
// can move one locale if he's not blocked
647647
let std_destination_maybe = start_locale.displace(standard_offset);
648648
if let Some(destination_locale) = std_destination_maybe {
@@ -703,13 +703,13 @@ impl WorldState {
703703
JobDescription::Figurehead => FIGUREHEAD_MOVEMENT_TABLE,
704704
_ => moral_panic!("non-ponylike agent passed to `ponylike_lookahead`"),
705705
};
706-
for start_locale in positional_chart.to_locales().into_iter() {
706+
for start_locale in positional_chart.to_locales() {
707707
let destinations = self.occupied_by(agent.team)
708708
.invert()
709709
.intersection(Pinfield(movement_table[
710710
start_locale.pindex() as usize]))
711711
.to_locales();
712-
for destination in destinations.into_iter() {
712+
for destination in destinations {
713713
self.predict(&mut premonitions,
714714
Patch {
715715
star: agent,
@@ -742,7 +742,7 @@ impl WorldState {
742742
_ => moral_panic!("non-princesslike agent passed to \
743743
`princesslike_lookahead`"),
744744
};
745-
for start_locale in positional_chart.to_locales().into_iter() {
745+
for start_locale in positional_chart.to_locales() {
746746
for &offset in &offsets {
747747
let mut venture = 1;
748748
loop {
@@ -1350,7 +1350,7 @@ mod tests {
13501350
whence: Locale::from_algebraic("g2".to_owned()),
13511351
whither: Locale::from_algebraic("g4".to_owned()) },
13521352
];
1353-
for patch in fools_patchset.into_iter() {
1353+
for patch in fools_patchset {
13541354
world = world.careful_apply(patch).unwrap().tree;
13551355
}
13561356
world

src/mind.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ pub fn score(world: WorldState) -> f32 {
5252

5353
valuation += REWARD_FOR_INITIATIVE * orientation(world.initiative);
5454

55-
for team in Team::league().into_iter() {
56-
for agent in Agent::dramatis_personæ(team).into_iter() {
55+
for team in Team::league() {
56+
for agent in Agent::dramatis_personæ(team) {
5757
valuation += world.agent_to_pinfield_ref(agent)
5858
.pincount() as f32 *
5959
figurine_valuation(agent);
@@ -236,7 +236,7 @@ pub fn α_β_negamax_search(
236236
let experience = intuition_bank.lock();
237237
order_movements_intuitively(&experience, &mut premonitions)
238238
}
239-
for premonition in premonitions.into_iter() {
239+
for premonition in premonitions {
240240
let mut value = NEG_INFINITY; // can't hurt to be pessimistic
241241
let mut extended_variation = variation.clone();
242242
extended_variation.push(premonition.patch);

0 commit comments

Comments
 (0)