Skip to content

Commit 5d21cae

Browse files
committed
Remove dependency on more-asserts
In my recent adventures to do a bit of gardening on our dependencies I noticed that there's a new major version for the `more-asserts` crate. Instead of updating to this though I've opted to instead remove the dependency since I don't think we heavily lean on this crate and otherwise one-off prints are probably sufficient to avoid the need for pulling in a whole crate for this.
1 parent 1d319c0 commit 5d21cae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+125
-223
lines changed

Cargo.lock

Lines changed: 0 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ rustix = { version = "0.35.6", features = ["mm", "param"] }
4646
wasmtime = { path = "crates/wasmtime", version = "0.40.0" }
4747
env_logger = "0.9.0"
4848
filecheck = "0.5.0"
49-
more-asserts = "0.2.1"
5049
tempfile = "3.1.0"
5150
test-programs = { path = "crates/test-programs" }
5251
wasmtime-runtime = { path = "crates/runtime" }

crates/cache/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,5 @@ rustix = { version = "0.35.6", features = ["process"] }
3232
[dev-dependencies]
3333
filetime = "0.2.7"
3434
once_cell = "1.12.0"
35-
more-asserts = "0.2.1"
3635
pretty_env_logger = "0.4.0"
3736
tempfile = "3"

crates/cache/src/worker/tests.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use super::*;
22
use crate::config::tests::test_prolog;
3-
use more_asserts::{assert_ge, assert_gt, assert_lt};
43
use std::iter::repeat;
54
use std::process;
65
// load_config! comes from crate::cache(::config::tests);
@@ -150,10 +149,7 @@ fn test_on_get_recompress_with_mod_file() {
150149
let scenarios = [(4, false), (7, true), (2, false)];
151150

152151
let mut usages = start_stats.usages;
153-
assert_lt!(
154-
usages,
155-
cache_config.optimized_compression_usage_counter_threshold()
156-
);
152+
assert!(usages < cache_config.optimized_compression_usage_counter_threshold());
157153
let mut tested_higher_opt_compr_lvl = false;
158154
for (times_used, lower_compr_lvl) in &scenarios {
159155
for _ in 0..*times_used {
@@ -180,19 +176,13 @@ fn test_on_get_recompress_with_mod_file() {
180176
assert_eq!(decoded_data, mod_data.as_bytes());
181177

182178
if *lower_compr_lvl {
183-
assert_ge!(
184-
usages,
185-
cache_config.optimized_compression_usage_counter_threshold()
186-
);
179+
assert!(usages >= cache_config.optimized_compression_usage_counter_threshold());
187180
tested_higher_opt_compr_lvl = true;
188181
stats.compression_level -= 1;
189182
assert!(write_stats_file(&stats_file, &stats));
190183
}
191184
}
192-
assert_ge!(
193-
usages,
194-
cache_config.optimized_compression_usage_counter_threshold()
195-
);
185+
assert!(usages >= cache_config.optimized_compression_usage_counter_threshold());
196186
assert!(tested_higher_opt_compr_lvl);
197187
}
198188

@@ -428,7 +418,7 @@ fn test_on_update_cleanup_limits_trash_locks() {
428418
"past",
429419
&Duration::from_secs(secs_ago),
430420
);
431-
assert_gt!(secs_ago, 0);
421+
assert!(secs_ago > 0);
432422
secs_ago -= 1;
433423
}
434424

crates/cranelift/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ wasmparser = "0.87.0"
2323
target-lexicon = "0.12"
2424
gimli = { version = "0.26.0", default-features = false, features = ['read', 'std'] }
2525
object = { version = "0.29.0", default-features = false, features = ['write'] }
26-
more-asserts = "0.2.1"
2726
thiserror = "1.0.4"
2827

2928
[features]

crates/cranelift/src/debug/transform/address_transform.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::{CompiledFunctions, FunctionAddressMap};
22
use gimli::write;
3-
use more_asserts::assert_le;
43
use std::collections::BTreeMap;
54
use std::iter::FromIterator;
65
use wasmtime_environ::{DefinedFuncIndex, EntityRef, FilePos, PrimaryMap, WasmFileInfo};
@@ -87,13 +86,10 @@ fn build_function_lookup(
8786
ft: &FunctionAddressMap,
8887
code_section_offset: u64,
8988
) -> (WasmAddress, WasmAddress, FuncLookup) {
90-
assert_le!(
91-
code_section_offset,
92-
ft.start_srcloc.file_offset().unwrap().into()
93-
);
89+
assert!(code_section_offset <= ft.start_srcloc.file_offset().unwrap().into());
9490
let fn_start = get_wasm_code_offset(ft.start_srcloc, code_section_offset);
9591
let fn_end = get_wasm_code_offset(ft.end_srcloc, code_section_offset);
96-
assert_le!(fn_start, fn_end);
92+
assert!(fn_start <= fn_end);
9793

9894
// Build ranges of continuous source locations. The new ranges starts when
9995
// non-descending order is interrupted. Assuming the same origin location can
@@ -111,8 +107,8 @@ fn build_function_lookup(
111107
}
112108

113109
let offset = get_wasm_code_offset(t.srcloc, code_section_offset);
114-
assert_le!(fn_start, offset);
115-
assert_le!(offset, fn_end);
110+
assert!(fn_start <= offset);
111+
assert!(offset <= fn_end);
116112

117113
let inst_gen_start = t.code_offset as usize;
118114
let inst_gen_end = match ft.instructions.get(i + 1) {
@@ -213,7 +209,7 @@ fn build_function_addr_map(
213209
if cfg!(debug_assertions) {
214210
// fn_map is sorted by the generated field -- see FunctionAddressMap::instructions.
215211
for i in 1..fn_map.len() {
216-
assert_le!(fn_map[i - 1].generated, fn_map[i].generated);
212+
assert!(fn_map[i - 1].generated <= fn_map[i].generated);
217213
}
218214
}
219215

crates/cranelift/src/debug/transform/expression.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use cranelift_codegen::isa::TargetIsa;
66
use cranelift_codegen::ValueLabelsRanges;
77
use cranelift_wasm::get_vmctx_value_label;
88
use gimli::{self, write, Expression, Operation, Reader, ReaderOffset, X86_64};
9-
use more_asserts::{assert_le, assert_lt};
109
use std::cmp::PartialEq;
1110
use std::collections::{HashMap, HashSet};
1211
use std::hash::{Hash, Hasher};
@@ -687,7 +686,7 @@ impl<'a, 'b> ValueLabelRangesBuilder<'a, 'b> {
687686
if range_start == range_end {
688687
continue;
689688
}
690-
assert_lt!(range_start, range_end);
689+
assert!(range_start < range_end);
691690

692691
// Find acceptable scope of ranges to intersect with.
693692
let i = match ranges.binary_search_by(|s| s.start.cmp(&range_start)) {
@@ -716,7 +715,7 @@ impl<'a, 'b> ValueLabelRangesBuilder<'a, 'b> {
716715
tail.start = range_end;
717716
ranges.insert(i + 1, tail);
718717
}
719-
assert_le!(ranges[i].end, range_end);
718+
assert!(ranges[i].end <= range_end);
720719
if range_start <= ranges[i].start {
721720
ranges[i].label_location.insert(label, loc);
722721
continue;

crates/cranelift/src/debug/transform/line_program.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use gimli::{
66
write, DebugLine, DebugLineOffset, DebugLineStr, DebugStr, DebugStrOffsets,
77
DebuggingInformationEntry, LineEncoding, Unit,
88
};
9-
use more_asserts::assert_le;
109
use wasmtime_environ::{DefinedFuncIndex, EntityRef};
1110

1211
#[derive(Debug)]
@@ -93,7 +92,7 @@ where
9392
if let Ok(program) = program {
9493
let header = program.header();
9594
let file_index_base = if header.version() < 5 { 1 } else { 0 };
96-
assert_le!(header.version(), 5, "not supported 6");
95+
assert!(header.version() <= 5, "not supported 6");
9796
let line_encoding = LineEncoding {
9897
minimum_instruction_length: header.minimum_instruction_length(),
9998
maximum_operations_per_instruction: header.maximum_operations_per_instruction(),

crates/cranelift/src/debug/transform/range_info_builder.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use super::address_transform::AddressTransform;
22
use super::{DebugInputContext, Reader};
33
use anyhow::Error;
44
use gimli::{write, AttributeValue, DebuggingInformationEntry, RangeListsOffset, Unit};
5-
use more_asserts::assert_lt;
65
use wasmtime_environ::{DefinedFuncIndex, EntityRef};
76

87
pub(crate) enum RangeInfoBuilder {
@@ -206,7 +205,7 @@ impl RangeInfoBuilder {
206205
if let RangeInfoBuilder::Ranges(ranges) = self {
207206
let mut range_list = Vec::new();
208207
for (begin, end) in ranges {
209-
assert_lt!(begin, end);
208+
assert!(begin < end);
210209
range_list.extend(addr_tr.translate_ranges(*begin, *end).map(|tr| {
211210
write::Range::StartLength {
212211
begin: tr.0,

crates/environ/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ indexmap = { version = "1.0.2", features = ["serde-1"] }
1919
thiserror = "1.0.4"
2020
serde = { version = "1.0.94", features = ["derive"] }
2121
log = { version = "0.4.8", default-features = false }
22-
more-asserts = "0.2.1"
2322
gimli = { version = "0.26.0", default-features = false, features = ['read'] }
2423
object = { version = "0.29.0", default-features = false, features = ['read_core', 'write_core', 'elf'] }
2524
target-lexicon = "0.12"

0 commit comments

Comments
 (0)