diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 99e619bb8..abc362744 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.98.1" +channel = "1.99.1" profile = "default" diff --git a/src/asset/pool.rs b/src/asset/pool.rs index 5b0fd9f18..741897513 100644 --- a/src/asset/pool.rs +++ b/src/asset/pool.rs @@ -231,7 +231,7 @@ mod tests { #[rstest] fn asset_pool_new() { - assert!(AssetPool::new().assets.is_empty()); + assert_eq!(AssetPool::new().assets, []); } #[rstest] @@ -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); } @@ -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) { 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) @@ -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] @@ -691,6 +691,6 @@ mod tests { asset_pool.decommission_mothballed(2025, 10); - assert!(asset_pool.assets.is_empty()); + assert_eq!(asset_pool.assets, []); } } diff --git a/src/example.rs b/src/example.rs index e084976df..00414f424 100644 --- a/src/example.rs +++ b/src/example.rs @@ -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(), ""); } } } diff --git a/src/settings.rs b/src/settings.rs index 6fe834e8e..538dfd838 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -165,6 +165,6 @@ mod tests { #[test] fn default_file_contents() { - assert!(!Settings::default_file_contents().is_empty()); + assert_ne!(Settings::default_file_contents(), ""); } } diff --git a/src/simulation/investment.rs b/src/simulation/investment.rs index 1340c402a..282e4b056 100644 --- a/src/simulation/investment.rs +++ b/src/simulation/investment.rs @@ -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] diff --git a/src/simulation/optimisation.rs b/src/simulation/optimisation.rs index 3b42e591e..62e91f37c 100644 --- a/src/simulation/optimisation.rs +++ b/src/simulation/optimisation.rs @@ -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(); @@ -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, diff --git a/src/simulation/optimisation/constraints.rs b/src/simulation/optimisation/constraints.rs index fd233408a..d98bd8f5b 100644 --- a/src/simulation/optimisation/constraints.rs +++ b/src/simulation/optimisation/constraints.rs @@ -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] diff --git a/tests/cli.rs b/tests/cli.rs index 28796b9ec..4a51ba3aa 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -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]