Skip to content

Commit 2f5fbde

Browse files
committed
AssetPool: Tidy mothball_unretained()
1 parent 2e21d91 commit 2f5fbde

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/asset/pool.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ impl AssetPool {
9999
decommissioned.extend(to_decommission);
100100
}
101101

102-
/// Mothball the specified assets if they are no longer in the active pool and put them back again.
102+
/// Mothball the specified assets if they are no longer in the active pool and put them back
103+
/// again.
103104
///
104105
/// # Arguments
105106
///
@@ -114,10 +115,12 @@ impl AssetPool {
114115
I: IntoIterator<Item = AssetRef>,
115116
{
116117
for mut asset in assets {
117-
if match asset.state {
118+
let in_pool = match asset.state {
118119
AssetState::Commissioned { .. } => !self.assets.contains(&asset),
119120
_ => panic!("Cannot mothball asset that has not been commissioned"),
120-
} {
121+
};
122+
123+
if in_pool {
121124
// If not already set, we set the current year as the mothball year,
122125
// i.e. the first one the asset was not used.
123126
if asset.get_mothballed_year().is_none() {

0 commit comments

Comments
 (0)