@@ -195,14 +195,14 @@ pub fn main_args(args: &[~str]) -> int {
195195
196196 info ! ( "going to format" ) ;
197197 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 => {
200200 match html:: render:: run ( krate, output. unwrap_or ( Path :: new ( "doc" ) ) ) {
201201 Ok ( ( ) ) => { }
202202 Err ( e) => fail ! ( "failed to generate documentation: {}" , e) ,
203203 }
204204 }
205- Some ( ~ "json") => {
205+ Some ( "json" ) => {
206206 match json_output ( krate, res, output. unwrap_or ( Path :: new ( "doc.json" ) ) ) {
207207 Ok ( ( ) ) => { }
208208 Err ( e) => fail ! ( "failed to write json: {}" , e) ,
@@ -223,9 +223,9 @@ pub fn main_args(args: &[~str]) -> int {
223223/// and files and then generates the necessary rustdoc output for formatting.
224224fn acquire_input ( input : & str ,
225225 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) ,
229229 Some ( s) => Err ( "unknown input format: " + s) ,
230230 None => {
231231 if input. ends_with ( ".json" ) {
@@ -265,15 +265,15 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output {
265265 Some ( nested) => {
266266 for inner in nested. iter ( ) {
267267 match * inner {
268- clean:: Word ( ~ "no_default_passes") => {
268+ clean:: Word ( ref x ) if "no_default_passes" == * x => {
269269 default_passes = false ;
270270 }
271- clean:: NameValue ( ~"passes" , ref value) => {
271+ clean:: NameValue ( ref x , ref value) if "passes" == * x => {
272272 for pass in value. words ( ) {
273273 passes. push ( pass. to_owned ( ) ) ;
274274 }
275275 }
276- clean:: NameValue ( ~"plugins" , ref value) => {
276+ clean:: NameValue ( ref x , ref value) if "plugins" == * x => {
277277 for p in value. words ( ) {
278278 plugins. push ( p. to_owned ( ) ) ;
279279 }
0 commit comments