Skip to content

Commit 390bd7c

Browse files
committed
Revert "Impl get_size::GetSize (behind feature flag) (#336)"
This reverts commit cf03b15. Avoids a cyclic dependency when the build includes the `get-size/derive` feature.
1 parent cf03b15 commit 390bd7c

File tree

3 files changed

+0
-72
lines changed

3 files changed

+0
-72
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ drain_keep_rest = ["drain_filter"]
2121

2222
[dependencies]
2323
serde = { version = "1", optional = true, default-features = false }
24-
get-size = { version = "0.1", optional = true, default-features = false }
2524

2625
[dev_dependencies]
2726
bincode = "1.0.1"

src/lib.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@
4545
//! [Rustonomicon](https://doc.rust-lang.org/1.42.0/nomicon/dropck.html#an-escape-hatch).
4646
//!
4747
//! Tracking issue: [rust-lang/rust#34761](https://github.com/rust-lang/rust/issues/34761)
48-
//!
49-
//! ### `get-size`
50-
//!
51-
//! When this optional dependency is enabled, `SmallVec` implements the `get_size::GetSize` trait.
5248
5349
#![no_std]
5450
#![cfg_attr(docsrs, feature(doc_cfg))]
@@ -92,8 +88,6 @@ use serde::{
9288
};
9389
#[cfg(feature = "write")]
9490
use std::io;
95-
#[cfg(feature = "get-size")]
96-
use get_size::GetSize;
9791

9892
/// Error type for APIs with fallible heap allocation
9993
#[derive(Debug)]
@@ -2182,22 +2176,3 @@ impl<const N: usize> io::Write for SmallVec<u8, N> {
21822176
Ok(())
21832177
}
21842178
}
2185-
2186-
#[cfg(feature = "get-size")]
2187-
impl<T, const N: usize> GetSize for SmallVec<T, N>
2188-
where
2189-
T: GetSize,
2190-
{
2191-
fn get_heap_size(&self) -> usize {
2192-
let mut total = 0;
2193-
if self.spilled() {
2194-
total += self.capacity() * T::get_stack_size();
2195-
}
2196-
2197-
for v in self.iter() {
2198-
total += v.get_heap_size();
2199-
}
2200-
2201-
total
2202-
}
2203-
}

src/tests.rs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,49 +1028,3 @@ fn drain_keep_rest() {
10281028

10291029
assert_eq!(a, SmallVec::<i32, 3>::from_slice(&[1i32, 3, 5, 6, 7, 8]));
10301030
}
1031-
1032-
#[cfg(all(feature = "get-size", target_pointer_width = "64"))]
1033-
#[test]
1034-
fn get_size_end_to_end1() {
1035-
use ::get_size::GetSize;
1036-
1037-
assert_eq!(SmallVec::<i32, 2>::get_stack_size(), 24);
1038-
assert_eq!(SmallVec::<i32, 10>::get_stack_size(), 48);
1039-
1040-
let mut a: SmallVec<i32, 2> = smallvec![];
1041-
assert!(!a.spilled());
1042-
assert_eq!(a.len(), 0);
1043-
assert_eq!(a.get_size(), 24);
1044-
assert_eq!(a.get_heap_size(), 0);
1045-
1046-
a.push(0);
1047-
assert_eq!(a.len(), 1);
1048-
assert!(!a.spilled());
1049-
assert_eq!(a.get_size(), 24);
1050-
assert_eq!(a.get_heap_size(), 0);
1051-
1052-
a.push(1);
1053-
assert_eq!(a.len(), 2);
1054-
assert!(!a.spilled());
1055-
assert_eq!(a.get_size(), 24);
1056-
assert_eq!(a.get_heap_size(), 0);
1057-
1058-
a.push(2);
1059-
assert_eq!(a.len(), 3);
1060-
assert!(a.spilled());
1061-
assert_eq!(a.get_size(), 40);
1062-
assert_eq!(a.get_heap_size(), 16);
1063-
1064-
a.push(3);
1065-
assert_eq!(a.len(), 4);
1066-
assert!(a.spilled());
1067-
assert_eq!(a.get_size(), 40);
1068-
assert_eq!(a.get_heap_size(), 16);
1069-
1070-
a.push(4);
1071-
assert_eq!(a.len(), 5);
1072-
assert!(a.spilled());
1073-
assert_eq!(a.get_size(), 56);
1074-
assert_eq!(a.get_heap_size(), 32);
1075-
1076-
}

0 commit comments

Comments
 (0)