Skip to content

Commit cbc98a3

Browse files
committed
Merge pull request #1 from steveklabnik/nits
nits
2 parents 5d1d3ee + 16bdcd9 commit cbc98a3

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/libcore/mem.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,28 +65,31 @@ pub use intrinsics::transmute;
6565
///
6666
/// # Example
6767
///
68+
/// Leak some heap memory by never deallocating it.
69+
///
6870
/// ```rust
6971
/// use std::mem;
7072
///
71-
/// // Leak some heap memory by never deallocating it
7273
/// let heap_memory = Box::new(3);
7374
/// mem::forget(heap_memory);
74-
///```
75+
/// ```
76+
///
77+
/// Leak an I/O object, never closing the file.
7578
///
7679
/// ```rust,no_run
7780
/// use std::mem;
7881
/// use std::fs::File;
7982
///
80-
/// // Leak an I/O object, never closing the file
8183
/// let file = File::open("foo.txt").unwrap();
8284
/// mem::forget(file);
83-
///```
85+
/// ```
86+
///
87+
/// The swap function uses forget to good effect.
8488
///
85-
///```rust
89+
/// ```rust
8690
/// use std::mem;
8791
/// use std::ptr;
8892
///
89-
/// // The swap function uses forget
9093
/// pub fn swap<T>(x: &mut T, y: &mut T) {
9194
/// unsafe {
9295
/// // Give ourselves some scratch space to work with

0 commit comments

Comments
 (0)