@@ -195,14 +195,14 @@ pub fn main_args(args: &[~str]) -> int {
195
195
196
196
info ! ( "going to format" ) ;
197
197
let started = time:: precise_time_ns ( ) ;
198
- match matches. opt_str ( "w" ) {
199
- Some ( ~ "html") | None => {
198
+ match matches. opt_str ( "w" ) . as_ref ( ) . map ( |s| s . as_slice ( ) ) {
199
+ Some ( "html" ) | None => {
200
200
match html:: render:: run ( krate, output. unwrap_or ( Path :: new ( "doc" ) ) ) {
201
201
Ok ( ( ) ) => { }
202
202
Err ( e) => fail ! ( "failed to generate documentation: {}" , e) ,
203
203
}
204
204
}
205
- Some ( ~ "json") => {
205
+ Some ( "json" ) => {
206
206
match json_output ( krate, res, output. unwrap_or ( Path :: new ( "doc.json" ) ) ) {
207
207
Ok ( ( ) ) => { }
208
208
Err ( e) => fail ! ( "failed to write json: {}" , e) ,
@@ -223,9 +223,9 @@ pub fn main_args(args: &[~str]) -> int {
223
223
/// and files and then generates the necessary rustdoc output for formatting.
224
224
fn acquire_input ( input : & str ,
225
225
matches : & getopts:: Matches ) -> Result < Output , ~str > {
226
- match matches. opt_str ( "r" ) {
227
- Some ( ~ "rust") => Ok ( rust_input ( input, matches) ) ,
228
- Some ( ~ "json") => json_input ( input) ,
226
+ match matches. opt_str ( "r" ) . as_ref ( ) . map ( |s| s . as_slice ( ) ) {
227
+ Some ( "rust" ) => Ok ( rust_input ( input, matches) ) ,
228
+ Some ( "json" ) => json_input ( input) ,
229
229
Some ( s) => Err ( "unknown input format: " + s) ,
230
230
None => {
231
231
if input. ends_with ( ".json" ) {
@@ -265,15 +265,15 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output {
265
265
Some ( nested) => {
266
266
for inner in nested. iter ( ) {
267
267
match * inner {
268
- clean:: Word ( ~ "no_default_passes") => {
268
+ clean:: Word ( ref x ) if "no_default_passes" == * x => {
269
269
default_passes = false ;
270
270
}
271
- clean:: NameValue ( ~"passes" , ref value) => {
271
+ clean:: NameValue ( ref x , ref value) if "passes" == * x => {
272
272
for pass in value. words ( ) {
273
273
passes. push ( pass. to_owned ( ) ) ;
274
274
}
275
275
}
276
- clean:: NameValue ( ~"plugins" , ref value) => {
276
+ clean:: NameValue ( ref x , ref value) if "plugins" == * x => {
277
277
for p in value. words ( ) {
278
278
plugins. push ( p. to_owned ( ) ) ;
279
279
}
0 commit comments