into_string to to_string, from_str to parse
This commit is contained in:
		
							
								
								
									
										12
									
								
								src/http.rs
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/http.rs
									
									
									
									
									
								
							| @@ -4,7 +4,7 @@ use std::cmp::min; | ||||
| use std::fmt; | ||||
| use std::io::{mod, Reader, IoResult, BufWriter}; | ||||
| use std::num::from_u16; | ||||
| use std::str::{mod, SendStr}; | ||||
| use std::str::{mod, SendStr, FromStr}; | ||||
|  | ||||
| use url::Url; | ||||
| use url::ParseError as UrlError; | ||||
| @@ -260,7 +260,7 @@ impl<W: Writer> Writer for HttpWriter<W> { | ||||
|                     Err(io::IoError { | ||||
|                         kind: io::ShortWrite(bytes), | ||||
|                         desc: "EmptyWriter cannot write any bytes", | ||||
|                         detail: Some("Cannot include a body with this kind of message".into_string()) | ||||
|                         detail: Some("Cannot include a body with this kind of message".to_string()) | ||||
|                     }) | ||||
|                 } | ||||
|             } | ||||
| @@ -397,7 +397,7 @@ pub fn read_method<R: Reader>(stream: &mut R) -> HttpResult<method::Method> { | ||||
|         (Some(method), _) => Ok(method), | ||||
|         (None, ext) => { | ||||
|             // We already checked that the buffer is ASCII | ||||
|             Ok(method::Method::Extension(unsafe { str::from_utf8_unchecked(ext) }.trim().into_string())) | ||||
|             Ok(method::Method::Extension(unsafe { str::from_utf8_unchecked(ext) }.trim().to_string())) | ||||
|         }, | ||||
|     } | ||||
| } | ||||
| @@ -622,7 +622,7 @@ pub fn read_status<R: Reader>(stream: &mut R) -> HttpResult<RawStatus> { | ||||
|         try!(stream.read_byte()), | ||||
|     ]; | ||||
|  | ||||
|     let code = match str::from_utf8(code.as_slice()).ok().and_then(from_str::<u16>) { | ||||
|     let code = match str::from_utf8(code.as_slice()).ok().and_then(FromStr::from_str) { | ||||
|         Some(num) => num, | ||||
|         None => return Err(HttpStatusError) | ||||
|     }; | ||||
| @@ -672,10 +672,10 @@ pub fn read_status<R: Reader>(stream: &mut R) -> HttpResult<RawStatus> { | ||||
|                 if phrase == reason { | ||||
|                     Borrowed(phrase) | ||||
|                 } else { | ||||
|                     Owned(reason.into_string()) | ||||
|                     Owned(reason.to_string()) | ||||
|                 } | ||||
|             } | ||||
|             _ => Owned(reason.into_string()) | ||||
|             _ => Owned(reason.to_string()) | ||||
|         }, | ||||
|         None => return Err(HttpStatusError) | ||||
|     }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user