Skip to content

Commit f40fa83

Browse files
committed
rollup merge of rust-lang#19288: steveklabnik/doc_style_cleanup
This is considered good convention. This is about half of them in total, I just don't want an impossible to land patch. 😄
2 parents 34b98b3 + f38e4e6 commit f40fa83

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1361
-1658
lines changed

src/libcollections/enum_set.rs

+19-21
Original file line numberDiff line numberDiff line change
@@ -42,27 +42,25 @@ impl<E:CLike+fmt::Show> fmt::Show for EnumSet<E> {
4242
}
4343
}
4444

45-
/**
46-
An interface for casting C-like enum to uint and back.
47-
A typically implementation is as below.
48-
49-
```{rust,ignore}
50-
#[repr(uint)]
51-
enum Foo {
52-
A, B, C
53-
}
54-
55-
impl CLike for Foo {
56-
fn to_uint(&self) -> uint {
57-
*self as uint
58-
}
59-
60-
fn from_uint(v: uint) -> Foo {
61-
unsafe { mem::transmute(v) }
62-
}
63-
}
64-
```
65-
*/
45+
/// An interface for casting C-like enum to uint and back.
46+
/// A typically implementation is as below.
47+
///
48+
/// ```{rust,ignore}
49+
/// #[repr(uint)]
50+
/// enum Foo {
51+
/// A, B, C
52+
/// }
53+
///
54+
/// impl CLike for Foo {
55+
/// fn to_uint(&self) -> uint {
56+
/// *self as uint
57+
/// }
58+
///
59+
/// fn from_uint(v: uint) -> Foo {
60+
/// unsafe { mem::transmute(v) }
61+
/// }
62+
/// }
63+
/// ```
6664
pub trait CLike {
6765
/// Converts a C-like enum to a `uint`.
6866
fn to_uint(&self) -> uint;

src/libcore/finally.rs

+30-32
Original file line numberDiff line numberDiff line change
@@ -58,38 +58,36 @@ impl<T> Finally<T> for fn() -> T {
5858
}
5959
}
6060

61-
/**
62-
* The most general form of the `finally` functions. The function
63-
* `try_fn` will be invoked first; whether or not it panics, the
64-
* function `finally_fn` will be invoked next. The two parameters
65-
* `mutate` and `drop` are used to thread state through the two
66-
* closures. `mutate` is used for any shared, mutable state that both
67-
* closures require access to; `drop` is used for any state that the
68-
* `try_fn` requires ownership of.
69-
*
70-
* **WARNING:** While shared, mutable state between the try and finally
71-
* function is often necessary, one must be very careful; the `try`
72-
* function could have panicked at any point, so the values of the shared
73-
* state may be inconsistent.
74-
*
75-
* # Example
76-
*
77-
* ```
78-
* use std::finally::try_finally;
79-
*
80-
* struct State<'a> { buffer: &'a mut [u8], len: uint }
81-
* # let mut buf = [];
82-
* let mut state = State { buffer: &mut buf, len: 0 };
83-
* try_finally(
84-
* &mut state, (),
85-
* |state, ()| {
86-
* // use state.buffer, state.len
87-
* },
88-
* |state| {
89-
* // use state.buffer, state.len to cleanup
90-
* })
91-
* ```
92-
*/
61+
/// The most general form of the `finally` functions. The function
62+
/// `try_fn` will be invoked first; whether or not it panics, the
63+
/// function `finally_fn` will be invoked next. The two parameters
64+
/// `mutate` and `drop` are used to thread state through the two
65+
/// closures. `mutate` is used for any shared, mutable state that both
66+
/// closures require access to; `drop` is used for any state that the
67+
/// `try_fn` requires ownership of.
68+
///
69+
/// **WARNING:** While shared, mutable state between the try and finally
70+
/// function is often necessary, one must be very careful; the `try`
71+
/// function could have panicked at any point, so the values of the shared
72+
/// state may be inconsistent.
73+
///
74+
/// # Example
75+
///
76+
/// ```
77+
/// use std::finally::try_finally;
78+
///
79+
/// struct State<'a> { buffer: &'a mut [u8], len: uint }
80+
/// # let mut buf = [];
81+
/// let mut state = State { buffer: &mut buf, len: 0 };
82+
/// try_finally(
83+
/// &mut state, (),
84+
/// |state, ()| {
85+
/// // use state.buffer, state.len
86+
/// },
87+
/// |state| {
88+
/// // use state.buffer, state.len to cleanup
89+
/// })
90+
/// ```
9391
pub fn try_finally<T,U,R>(mutate: &mut T,
9492
drop: U,
9593
try_fn: |&mut T, U| -> R,

src/libcore/fmt/float.rs

+30-30
Original file line numberDiff line numberDiff line change
@@ -54,36 +54,36 @@ pub enum SignFormat {
5454

5555
static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u;
5656

57-
/**
58-
* Converts a number to its string representation as a byte vector.
59-
* This is meant to be a common base implementation for all numeric string
60-
* conversion functions like `to_string()` or `to_str_radix()`.
61-
*
62-
* # Arguments
63-
* - `num` - The number to convert. Accepts any number that
64-
* implements the numeric traits.
65-
* - `radix` - Base to use. Accepts only the values 2-36. If the exponential notation
66-
* is used, then this base is only used for the significand. The exponent
67-
* itself always printed using a base of 10.
68-
* - `negative_zero` - Whether to treat the special value `-0` as
69-
* `-0` or as `+0`.
70-
* - `sign` - How to emit the sign. See `SignFormat`.
71-
* - `digits` - The amount of digits to use for emitting the fractional
72-
* part, if any. See `SignificantDigits`.
73-
* - `exp_format` - Whether or not to use the exponential (scientific) notation.
74-
* See `ExponentFormat`.
75-
* - `exp_capital` - Whether or not to use a capital letter for the exponent sign, if
76-
* exponential notation is desired.
77-
* - `f` - A closure to invoke with the bytes representing the
78-
* float.
79-
*
80-
* # Panics
81-
* - Panics if `radix` < 2 or `radix` > 36.
82-
* - Panics if `radix` > 14 and `exp_format` is `ExpDec` due to conflict
83-
* between digit and exponent sign `'e'`.
84-
* - Panics if `radix` > 25 and `exp_format` is `ExpBin` due to conflict
85-
* between digit and exponent sign `'p'`.
86-
*/
57+
/// Converts a number to its string representation as a byte vector.
58+
/// This is meant to be a common base implementation for all numeric string
59+
/// conversion functions like `to_string()` or `to_str_radix()`.
60+
///
61+
/// # Arguments
62+
///
63+
/// - `num` - The number to convert. Accepts any number that
64+
/// implements the numeric traits.
65+
/// - `radix` - Base to use. Accepts only the values 2-36. If the exponential notation
66+
/// is used, then this base is only used for the significand. The exponent
67+
/// itself always printed using a base of 10.
68+
/// - `negative_zero` - Whether to treat the special value `-0` as
69+
/// `-0` or as `+0`.
70+
/// - `sign` - How to emit the sign. See `SignFormat`.
71+
/// - `digits` - The amount of digits to use for emitting the fractional
72+
/// part, if any. See `SignificantDigits`.
73+
/// - `exp_format` - Whether or not to use the exponential (scientific) notation.
74+
/// See `ExponentFormat`.
75+
/// - `exp_capital` - Whether or not to use a capital letter for the exponent sign, if
76+
/// exponential notation is desired.
77+
/// - `f` - A closure to invoke with the bytes representing the
78+
/// float.
79+
///
80+
/// # Panics
81+
///
82+
/// - Panics if `radix` < 2 or `radix` > 36.
83+
/// - Panics if `radix` > 14 and `exp_format` is `ExpDec` due to conflict
84+
/// between digit and exponent sign `'e'`.
85+
/// - Panics if `radix` > 25 and `exp_format` is `ExpBin` due to conflict
86+
/// between digit and exponent sign `'p'`.
8787
pub fn float_to_str_bytes_common<T: Float, U>(
8888
num: T,
8989
radix: uint,

0 commit comments

Comments
 (0)