Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.98.1"
channel = "1.99.1"
profile = "default"
16 changes: 8 additions & 8 deletions src/asset/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ mod tests {

#[rstest]
fn asset_pool_new() {
assert!(AssetPool::new().assets.is_empty());
assert_eq!(AssetPool::new().assets, []);
}

#[rstest]
Expand Down Expand Up @@ -263,9 +263,9 @@ mod tests {
let commission_year = multi_tranche_asset.commission_year;
let mut asset_pool = AssetPool::new();
let mut user_assets = vec![multi_tranche_asset.into()];
assert!(asset_pool.assets.is_empty());
assert_eq!(asset_pool.assets, []);
asset_pool.commission_new(commission_year, &mut user_assets);
assert!(user_assets.is_empty());
assert_eq!(user_assets, []);
assert_eq!(asset_pool.assets.len(), 1);
assert_eq!(asset_pool.next_id, 1);
}
Expand All @@ -274,16 +274,16 @@ mod tests {
fn asset_pool_commission_already_decommissioned(asset: Asset) {
let year = asset.max_decommission_year();
let mut asset_pool = AssetPool::new();
assert!(asset_pool.assets.is_empty());
assert_eq!(asset_pool.assets, []);
asset_pool.commission_new(year, &mut vec![asset.into()]);
assert!(asset_pool.assets.is_empty());
assert_eq!(asset_pool.assets, []);
}

#[rstest]
fn asset_pool_decommission_old(mut user_assets: Vec<UserAsset>) {
let mut asset_pool = AssetPool::new();
asset_pool.commission_new(2020, &mut user_assets);
assert!(user_assets.is_empty());
assert_eq!(user_assets, []);
assert_eq!(asset_pool.assets.len(), 2);

// should decommission first asset (lifetime == 5)
Expand All @@ -298,7 +298,7 @@ mod tests {

// should decommission second asset
asset_pool.decommission_old(2040);
assert!(asset_pool.assets.is_empty());
assert_eq!(asset_pool.assets, []);
}

#[rstest]
Expand Down Expand Up @@ -691,6 +691,6 @@ mod tests {

asset_pool.decommission_mothballed(2025, 10);

assert!(asset_pool.assets.is_empty());
assert_eq!(asset_pool.assets, []);
}
}
2 changes: 1 addition & 1 deletion src/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ mod tests {
.with_context(|| format!("Could not load readme for {example}"))
.unwrap();

assert!(!readme.trim().is_empty());
assert_ne!(readme.trim(), "");
}
}
}
2 changes: 1 addition & 1 deletion src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,6 @@ mod tests {

#[test]
fn default_file_contents() {
assert!(!Settings::default_file_contents().is_empty());
assert_ne!(Settings::default_file_contents(), "");
}
}
2 changes: 1 addition & 1 deletion src/simulation/investment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ mod tests {
// Check all assets are removed when `only_candidates` is false
opt_assets.push(candidate_asset.clone().into());
remove_assets_exceeding_agent_limits(&mut opt_assets, &limits, false);
assert!(opt_assets.is_empty());
assert_eq!(opt_assets, []);
}

#[rstest]
Expand Down
4 changes: 2 additions & 2 deletions src/simulation/optimisation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl VariableMap {
model: &Model,
markets_to_allow_unmet_demand: &[(CommodityID, RegionID)],
) {
assert!(!markets_to_allow_unmet_demand.is_empty());
assert_ne!(markets_to_allow_unmet_demand, []);

// This line **must** come before we add more variables
let start = problem.num_cols();
Expand Down Expand Up @@ -499,7 +499,7 @@ impl<'model, 'run> DispatchRun<'model, 'run> {
self,
markets_to_balance: &'run [(CommodityID, RegionID)],
) -> Self {
assert!(!markets_to_balance.is_empty());
assert_ne!(markets_to_balance, []);

Self {
markets_to_balance,
Expand Down
5 changes: 4 additions & 1 deletion src/simulation/optimisation/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,10 @@ mod tests {

#[test]
fn groups_no_assets() {
assert!(group_dispatch_equivalent_assets(std::iter::empty()).is_empty());
assert_eq!(
group_dispatch_equivalent_assets(std::iter::empty()),
[] as [std::vec::Vec<&AssetRef>; 0]
);
}

#[rstest]
Expand Down
2 changes: 1 addition & 1 deletion tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fn check_example_list_command(#[case] patch: bool) {
/// Test the `example info` command
#[test]
fn check_example_info_command() {
assert!(!get_muse2_stdout(&["example", "info", EXAMPLE_NAME]).is_empty());
assert_ne!(get_muse2_stdout(&["example", "info", EXAMPLE_NAME]), "");
}

#[test]
Expand Down
Loading