Skip to content

Commit d459e80

Browse files
committed
auto merge of #11142 : alan-andrade/rust/improve_opts_example, r=cmr
Ran into this in practice, fixing it to improve example correctness.
2 parents b88138a + ff801d6 commit d459e80

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/libextra/getopts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
//!
3232
//! ~~~{.rust}
3333
//! extern mod extra;
34-
//! use extra::getopts::*;
34+
//! use extra::getopts::{optopt,optflag,getopts,Opt};
3535
//! use std::os;
3636
//!
3737
//! fn do_work(inp: &str, out: Option<~str>) {

src/librustdoc/test.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ fn maketest(s: &str, cratename: &str) -> @str {
138138
let mut prog = ~r"
139139
#[deny(warnings)];
140140
#[allow(unused_variable, dead_assignment, unused_mut, attribute_usage, dead_code)];
141-
#[feature(macro_rules, globs, struct_variant, managed_boxes)];
142141
";
143142
if s.contains("extra") {
144143
prog.push_str("extern mod extra;\n");

src/libstd/str.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,15 @@ there are three common kinds of strings in rust:
3838
As an example, here's a few different kinds of strings.
3939
4040
```rust
41-
let owned_string = ~"I am an owned string";
42-
let managed_string = @"This string is garbage-collected";
43-
let borrowed_string1 = "This string is borrowed with the 'static lifetime";
44-
let borrowed_string2: &str = owned_string; // owned strings can be borrowed
45-
let borrowed_string3: &str = managed_string; // managed strings can also be borrowed
41+
#[feature(managed_boxes)];
42+
43+
fn main() {
44+
let owned_string = ~"I am an owned string";
45+
let managed_string = @"This string is garbage-collected";
46+
let borrowed_string1 = "This string is borrowed with the 'static lifetime";
47+
let borrowed_string2: &str = owned_string; // owned strings can be borrowed
48+
let borrowed_string3: &str = managed_string; // managed strings can also be borrowed
49+
}
4650
```
4751
4852
From the example above, you can see that rust has 3 different kinds of string

0 commit comments

Comments
 (0)