Skip to content

Commit 1919e8e

Browse files
committed
Adapt in-memory size check to Rust 1.65 and below
Rust 1.65 reduces size in memory, and to maintain compatibility with older compilers, let's just assure we don't grow without us knowning.
1 parent 04cfa63 commit 1919e8e

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

git-diff/src/tree/visit.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ mod tests {
7878

7979
#[test]
8080
fn size_of_change() {
81-
assert_eq!(
82-
std::mem::size_of::<Change>(),
83-
46,
84-
"this type shouldn't grow without us knowing"
81+
let actual = std::mem::size_of::<Change>();
82+
assert!(
83+
actual <= 46,
84+
"{} <= 46: this type shouldn't grow without us knowing",
85+
actual
8586
)
8687
}
8788
}

git-object/tests/object.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ fn fixture_bytes(path: &str) -> Vec<u8> {
3030

3131
#[test]
3232
fn size_in_memory() {
33-
assert_eq!(
34-
std::mem::size_of::<git_object::Object>(),
35-
264,
36-
"Prevent unexpected growth of what should be lightweight objects"
33+
let actual = std::mem::size_of::<git_object::Object>();
34+
assert!(
35+
actual <= 264,
36+
"{} <= 264: Prevent unexpected growth of what should be lightweight objects",
37+
actual
3738
)
3839
}

0 commit comments

Comments
 (0)