Skip to content

Commit 98b49e4

Browse files
Minor improvements to doc formatting. (#319)
1 parent fbb5c5b commit 98b49e4

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/lib.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,9 @@ impl<T, const N: usize> RawSmallVec<T, N> {
243243
}
244244
}
245245

246-
/// Vec guarantees that its length is always less than isize::MAX in *bytes*.
246+
/// Vec guarantees that its length is always less than [`isize::MAX`] in *bytes*.
247247
///
248-
/// For a non ZST, this means that the length is less than isize::MAX objects, which implies we
248+
/// For a non ZST, this means that the length is less than `isize::MAX` objects, which implies we
249249
/// have at least one free bit we can use. We use the least significant bit for the tag. And store
250250
/// the length in the `usize::BITS - 1` most significant bits.
251251
///
@@ -589,7 +589,7 @@ impl<T, const N: usize> SmallVec<T, N> {
589589
vec
590590
}
591591

592-
/// Constructs a new SmallVec on the stack from an A without copying elements. Also sets the length. The user is responsible for ensuring that len <= A::size().
592+
/// Constructs a new `SmallVec` on the stack from an A without copying elements. Also sets the length. The user is responsible for ensuring that `len <= A::size()`.
593593
///
594594
/// # Examples
595595
///
@@ -1198,22 +1198,22 @@ impl<T, const N: usize> SmallVec<T, N> {
11981198
}
11991199
}
12001200

1201-
/// Creates a SmallVec directly from the raw components of another SmallVec.
1201+
/// Creates a `SmallVec` directly from the raw components of another `SmallVec`.
12021202
///
12031203
/// # Safety
12041204
///
12051205
/// This is highly unsafe, due to the number of invariants that aren’t checked:
12061206
///
1207-
/// - ptr needs to have been previously allocated via SmallVec from its spilled storage (at least, it’s highly likely to be incorrect if it wasn’t).
1208-
/// - ptr’s A::Item type needs to be the same size and alignment that it was allocated with
1209-
/// - length needs to be less than or equal to capacity.
1210-
/// - capacity needs to be the capacity that the pointer was allocated with.
1207+
/// - `ptr` needs to have been previously allocated via `SmallVec` from its spilled storage (at least, it’s highly likely to be incorrect if it wasn’t).
1208+
/// - `ptr`’s `A::Item` type needs to be the same size and alignment that it was allocated with
1209+
/// - `length` needs to be less than or equal to `capacity`.
1210+
/// - `capacity` needs to be the capacity that the pointer was allocated with.
12111211
///
12121212
/// Violating these may cause problems like corrupting the allocator’s internal data structures.
12131213
///
1214-
/// Additionally, capacity must be greater than the amount of inline storage A has; that is, the new SmallVec must need to spill over into heap allocated storage. This condition is asserted against.
1214+
/// Additionally, `capacity` must be greater than the amount of inline storage `A` has; that is, the new `SmallVec` must need to spill over into heap allocated storage. This condition is asserted against.
12151215
///
1216-
/// The ownership of ptr is effectively transferred to the SmallVec which may then deallocate, reallocate or change the contents of memory pointed to by the pointer at will. Ensure that nothing else uses the pointer after calling this function.
1216+
/// The ownership of `ptr` is effectively transferred to the `SmallVec` which may then deallocate, reallocate or change the contents of memory pointed to by the pointer at will. Ensure that nothing else uses the pointer after calling this function.
12171217
///
12181218
/// # Examples
12191219
///

src/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ pub fn test_double_spill() {
7272
);
7373
}
7474

75-
/// https://github.com/servo/rust-smallvec/issues/4
75+
// https://github.com/servo/rust-smallvec/issues/4
7676
#[test]
7777
fn issue_4() {
7878
SmallVec::<Box<u32>, 2>::new();
7979
}
8080

81-
/// https://github.com/servo/rust-smallvec/issues/5
81+
// https://github.com/servo/rust-smallvec/issues/5
8282
#[test]
8383
fn issue_5() {
8484
assert!(Some(SmallVec::<&u32, 2>::new()).is_some());

0 commit comments

Comments
 (0)