Skip to content

Commit 2d69c58

Browse files
committed
Fix docs
1 parent a51a6a9 commit 2d69c58

File tree

3 files changed

+26
-27
lines changed

3 files changed

+26
-27
lines changed

crates/rune-alloc/src/hashbrown/serde.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ mod size_hint {
33

44
/// This presumably exists to prevent denial of service attacks.
55
///
6-
/// Original discussion: https://github.com/serde-rs/serde/issues/1114.
6+
/// Original discussion: <https://github.com/serde-rs/serde/issues/1114>.
77
#[cfg_attr(feature = "inline-more", inline)]
88
pub(super) fn cautious(hint: Option<usize>) -> usize {
99
cmp::min(hint.unwrap_or(0), 4096)

crates/rune-alloc/src/vec/mod.rs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ where
290290
///
291291
/// However, the pointer might not actually point to allocated memory. In
292292
/// particular, if you construct a `Vec` with capacity 0 via [`Vec::new`],
293-
/// [`try_vec![]`], [`Vec::try_with_capacity(0)`], or by calling
294-
/// [`try_shrink_to_fit`] on an empty Vec, it will not allocate memory.
293+
/// [`try_vec![]`], [`Vec::try_with_capacity`] with an argument of 0, or by
294+
/// calling [`try_shrink_to_fit`] on an empty Vec, it will not allocate memory.
295295
/// Similarly, if you store zero-sized types inside a `Vec`, it will not
296296
/// allocate space for them. *Note that in this case the `Vec` might not report
297297
/// a [`capacity`] of 0*. `Vec` will allocate if and only if
@@ -303,7 +303,6 @@ where
303303
/// it.
304304
///
305305
/// [`try_vec![]`]: try_vec!
306-
/// [`Vec::try_with_capacity(0)`]: Vec::try_with_capacity
307306
///
308307
/// If a `Vec` *has* allocated memory, then the memory it points to is on the heap
309308
/// (as defined by the allocator Rust is configured to use by default), and its
@@ -335,26 +334,26 @@ where
335334
/// `Vec` will never perform a "small optimization" where elements are actually
336335
/// stored on the stack for two reasons:
337336
///
338-
/// * It would make it more difficult for unsafe code to correctly manipulate
339-
/// a `Vec`. The contents of a `Vec` wouldn't have a stable address if it were
337+
/// * It would make it more difficult for unsafe code to correctly manipulate a
338+
/// `Vec`. The contents of a `Vec` wouldn't have a stable address if it were
340339
/// only moved, and it would be more difficult to determine if a `Vec` had
341340
/// actually allocated memory.
342341
///
343-
/// * It would penalize the general case, incurring an additional branch
344-
/// on every access.
342+
/// * It would penalize the general case, incurring an additional branch on
343+
/// every access.
345344
///
346345
/// `Vec` will never automatically shrink itself, even if completely empty. This
347346
/// ensures no unnecessary allocations or deallocations occur. Emptying a `Vec`
348347
/// and then filling it back up to the same [`len`] should incur no calls to the
349348
/// allocator. If you wish to free up unused memory, use [`try_shrink_to_fit`]
350349
/// or [`try_shrink_to`].
351350
///
352-
/// [`try_push`] and [`try_insert`] will never (re)allocate if the reported capacity is
353-
/// sufficient. [`try_push`] and [`try_insert`] *will* (re)allocate if
354-
/// <code>[len] == [capacity]</code>. That is, the reported capacity is completely
355-
/// accurate, and can be relied on. It can even be used to manually free the memory
356-
/// allocated by a `Vec` if desired. Bulk insertion methods *may* reallocate, even
357-
/// when not necessary.
351+
/// [`try_push`] and [`try_insert`] will never (re)allocate if the reported
352+
/// capacity is sufficient. [`try_push`] and [`try_insert`] *will* (re)allocate
353+
/// if <code>[len] == [capacity]</code>. That is, the reported capacity is
354+
/// completely accurate, and can be relied on. It can even be used to manually
355+
/// free the memory allocated by a `Vec` if desired. Bulk insertion methods
356+
/// *may* reallocate, even when not necessary.
358357
///
359358
/// `Vec` does not guarantee any particular growth strategy when reallocating
360359
/// when full, nor when [`try_reserve`] is called. The current strategy is basic
@@ -369,16 +368,16 @@ where
369368
///
370369
/// [`Vec::try_with_capacity(n)`]: Vec::try_with_capacity
371370
///
372-
/// `Vec` will not specifically overwrite any data that is removed from it,
373-
/// but also won't specifically preserve it. Its uninitialized memory is
374-
/// scratch space that it may use however it wants. It will generally just do
375-
/// whatever is most efficient or otherwise easy to implement. Do not rely on
376-
/// removed data to be erased for security purposes. Even if you drop a `Vec`, its
377-
/// buffer may simply be reused by another allocation. Even if you zero a `Vec`'s memory
378-
/// first, that might not actually happen because the optimizer does not consider
379-
/// this a side-effect that must be preserved. There is one case which we will
380-
/// not break, however: using `unsafe` code to write to the excess capacity,
381-
/// and then increasing the length to match, is always valid.
371+
/// `Vec` will not specifically overwrite any data that is removed from it, but
372+
/// also won't specifically preserve it. Its uninitialized memory is scratch
373+
/// space that it may use however it wants. It will generally just do whatever
374+
/// is most efficient or otherwise easy to implement. Do not rely on removed
375+
/// data to be erased for security purposes. Even if you drop a `Vec`, its
376+
/// buffer may simply be reused by another allocation. Even if you zero a
377+
/// `Vec`'s memory first, that might not actually happen because the optimizer
378+
/// does not consider this a side-effect that must be preserved. There is one
379+
/// case which we will not break, however: using `unsafe` code to write to the
380+
/// excess capacity, and then increasing the length to match, is always valid.
382381
///
383382
/// Currently, `Vec` does not guarantee the order in which elements are dropped.
384383
/// The order has changed in the past and may change again.

crates/rune/src/build.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ impl core::error::Error for BuildError {
8383
/// [`BuildError`] doesn't provide any diagnostics on what went wrong. To get
8484
/// rich diagnostics you should instead associated a [`Diagnostics`] type
8585
/// through [`Build::with_diagnostics`] and examine it before handling any
86-
/// [`Err(BuildError)`] produced.
86+
/// [`Err`] produced.
8787
///
88-
/// Uses the [Source::name] when generating diagnostics to reference the file.
88+
/// Uses the [`Source::name`] when generating diagnostics to reference the file.
8989
///
90-
/// [Source::name]: crate::Source::name
90+
/// [`Source::name`]: crate::Source::name
9191
///
9292
/// # Examples
9393
///

0 commit comments

Comments
 (0)