Skip to content

Commit 9b49ad2

Browse files
committed
doc: Cleanup.
Remove ~~~ for code block specification. Use /// Over /** */ for doc blocks.
1 parent 88cb454 commit 9b49ad2

File tree

9 files changed

+186
-213
lines changed

9 files changed

+186
-213
lines changed

src/libcore/fmt/num.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ pub struct RadixFmt<T, R>(T, R);
138138
///
139139
/// # Example
140140
///
141-
/// ~~~
141+
/// ```
142142
/// use std::fmt::radix;
143143
/// assert_eq!(format!("{}", radix(55i, 36)), "1j".to_string());
144-
/// ~~~
144+
/// ```
145145
pub fn radix<T>(x: T, base: u8) -> RadixFmt<T, Radix> {
146146
RadixFmt(x, Radix::new(base))
147147
}

src/libcore/num/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ pub trait Zero: Add<Self, Self> {
6161
///
6262
/// # Laws
6363
///
64-
/// ~~~text
64+
/// ```{.text}
6565
/// a + 0 = a ∀ a ∈ Self
6666
/// 0 + a = a ∀ a ∈ Self
67-
/// ~~~
67+
/// ```
6868
///
6969
/// # Purity
7070
///
@@ -114,10 +114,10 @@ pub trait One: Mul<Self, Self> {
114114
///
115115
/// # Laws
116116
///
117-
/// ~~~text
117+
/// ```{.text}
118118
/// a * 1 = a ∀ a ∈ Self
119119
/// 1 * a = a ∀ a ∈ Self
120-
/// ~~~
120+
/// ```
121121
///
122122
/// # Purity
123123
///

src/libcore/result.rs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
//! success and containing a value, and `Err(E)`, representing error
1616
//! and containing an error value.
1717
//!
18-
//! ~~~
18+
//! ```
1919
//! enum Result<T, E> {
2020
//! Ok(T),
2121
//! Err(E)
2222
//! }
23-
//! ~~~
23+
//! ```
2424
//!
2525
//! Functions return `Result` whenever errors are expected and
2626
//! recoverable. In the `std` crate `Result` is most prominently used
@@ -29,7 +29,7 @@
2929
//! A simple function returning `Result` might be
3030
//! defined and used like so:
3131
//!
32-
//! ~~~
32+
//! ```
3333
//! #[deriving(Show)]
3434
//! enum Version { Version1, Version2 }
3535
//!
@@ -53,13 +53,13 @@
5353
//! println!("error parsing header: {}", e);
5454
//! }
5555
//! }
56-
//! ~~~
56+
//! ```
5757
//!
5858
//! Pattern matching on `Result`s is clear and straightforward for
5959
//! simple cases, but `Result` comes with some convenience methods
6060
//! that make working it more succinct.
6161
//!
62-
//! ~~~
62+
//! ```
6363
//! let good_result: Result<int, int> = Ok(10);
6464
//! let bad_result: Result<int, int> = Err(10);
6565
//!
@@ -79,7 +79,7 @@
7979
//!
8080
//! // Consume the result and return the contents with `unwrap`.
8181
//! let final_awesome_result = good_result.ok().unwrap();
82-
//! ~~~
82+
//! ```
8383
//!
8484
//! # Results must be used
8585
//!
@@ -94,13 +94,13 @@
9494
//! Consider the `write_line` method defined for I/O types
9595
//! by the [`Writer`](../io/trait.Writer.html) trait:
9696
//!
97-
//! ~~~
97+
//! ```
9898
//! use std::io::IoError;
9999
//!
100100
//! trait Writer {
101101
//! fn write_line(&mut self, s: &str) -> Result<(), IoError>;
102102
//! }
103-
//! ~~~
103+
//! ```
104104
//!
105105
//! *Note: The actual definition of `Writer` uses `IoResult`, which
106106
//! is just a synonym for `Result<T, IoError>`.*
@@ -109,15 +109,15 @@
109109
//! fail. It's crucial to handle the error case, and *not* write
110110
//! something like this:
111111
//!
112-
//! ~~~ignore
112+
//! ```{.ignore}
113113
//! use std::io::{File, Open, Write};
114114
//!
115115
//! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
116116
//! // If `write_line` errors, then we'll never know, because the return
117117
//! // value is ignored.
118118
//! file.write_line("important message");
119119
//! drop(file);
120-
//! ~~~
120+
//! ```
121121
//!
122122
//! If you *do* write that in Rust, the compiler will by give you a
123123
//! warning (by default, controlled by the `unused_must_use` lint).
@@ -127,35 +127,35 @@
127127
//! success with `expect`. This will fail if the write fails, proving
128128
//! a marginally useful message indicating why:
129129
//!
130-
//! ~~~no_run
130+
//! ```{.no_run}
131131
//! use std::io::{File, Open, Write};
132132
//!
133133
//! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
134134
//! file.write_line("important message").ok().expect("failed to write message");
135135
//! drop(file);
136-
//! ~~~
136+
//! ```
137137
//!
138138
//! You might also simply assert success:
139139
//!
140-
//! ~~~no_run
140+
//! ```{.no_run}
141141
//! # use std::io::{File, Open, Write};
142142
//!
143143
//! # let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
144144
//! assert!(file.write_line("important message").is_ok());
145145
//! # drop(file);
146-
//! ~~~
146+
//! ```
147147
//!
148148
//! Or propagate the error up the call stack with `try!`:
149149
//!
150-
//! ~~~
150+
//! ```
151151
//! # use std::io::{File, Open, Write, IoError};
152152
//! fn write_message() -> Result<(), IoError> {
153153
//! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
154154
//! try!(file.write_line("important message"));
155155
//! drop(file);
156156
//! return Ok(());
157157
//! }
158-
//! ~~~
158+
//! ```
159159
//!
160160
//! # The `try!` macro
161161
//!
@@ -166,7 +166,7 @@
166166
//!
167167
//! It replaces this:
168168
//!
169-
//! ~~~
169+
//! ```
170170
//! use std::io::{File, Open, Write, IoError};
171171
//!
172172
//! struct Info {
@@ -188,11 +188,11 @@
188188
//! }
189189
//! return file.write_line(format!("rating: {}", info.rating).as_slice());
190190
//! }
191-
//! ~~~
191+
//! ```
192192
//!
193193
//! With this:
194194
//!
195-
//! ~~~
195+
//! ```
196196
//! use std::io::{File, Open, Write, IoError};
197197
//!
198198
//! struct Info {
@@ -209,7 +209,7 @@
209209
//! try!(file.write_line(format!("rating: {}", info.rating).as_slice()));
210210
//! return Ok(());
211211
//! }
212-
//! ~~~
212+
//! ```
213213
//!
214214
//! *It's much nicer!*
215215
//!
@@ -218,13 +218,13 @@
218218
//! `Err` is returned early from the enclosing function. Its simple definition
219219
//! makes it clear:
220220
//!
221-
//! ~~~
221+
//! ```
222222
//! # #![feature(macro_rules)]
223223
//! macro_rules! try(
224224
//! ($e:expr) => (match $e { Ok(e) => e, Err(e) => return Err(e) })
225225
//! )
226226
//! # fn main() { }
227-
//! ~~~
227+
//! ```
228228
//!
229229
//! `try!` is imported by the prelude, and is available everywhere.
230230
//!
@@ -245,10 +245,10 @@
245245
//!
246246
//! Converting to an `Option` with `ok()` to handle an error:
247247
//!
248-
//! ~~~
248+
//! ```
249249
//! use std::io::Timer;
250250
//! let mut t = Timer::new().ok().expect("failed to create timer!");
251-
//! ~~~
251+
//! ```
252252
//!
253253
//! # `Result` vs. `fail!`
254254
//!
@@ -440,12 +440,12 @@ impl<T, E> Result<T, E> {
440440
///
441441
/// This function can be used to compose the results of two functions.
442442
///
443-
/// # Examples
443+
/// # Example
444444
///
445445
/// Sum the lines of a buffer by mapping strings to numbers,
446446
/// ignoring I/O and parse errors:
447447
///
448-
/// ~~~
448+
/// ```
449449
/// use std::io::{BufReader, IoResult};
450450
///
451451
/// let buffer = "1\n2\n3\n4\n";
@@ -464,7 +464,7 @@ impl<T, E> Result<T, E> {
464464
/// }
465465
///
466466
/// assert!(sum == 10);
467-
/// ~~~
467+
/// ```
468468
#[inline]
469469
#[unstable = "waiting for unboxed closures"]
470470
pub fn map<U>(self, op: |T| -> U) -> Result<U,E> {

src/libgetopts/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
//! that requires an input file to be specified, accepts an optional output
3232
//! file name following `-o`, and accepts both `-h` and `--help` as optional flags.
3333
//!
34-
//! ~~~{.rust}
34+
//! ```{.rust}
3535
//! extern crate getopts;
3636
//! use getopts::{optopt,optflag,getopts,OptGroup};
3737
//! use std::os;
@@ -76,7 +76,7 @@
7676
//! };
7777
//! do_work(input.as_slice(), output);
7878
//! }
79-
//! ~~~
79+
//! ```
8080
8181
#![crate_name = "getopts"]
8282
#![experimental]

0 commit comments

Comments
 (0)