fix(rustup): get rid of slice pattern, add Reflect bounds
				
					
				
			* remove slice pattern * add `Reflect` trait bounds where necessary
This commit is contained in:
		
							
								
								
									
										30
									
								
								src/uri.rs
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								src/uri.rs
									
									
									
									
									
								
							| @@ -53,21 +53,21 @@ impl FromStr for RequestUri { | ||||
|     type Err = HttpError; | ||||
|  | ||||
|     fn from_str(s: &str) -> Result<RequestUri, HttpError> { | ||||
|         match s.as_bytes() { | ||||
|             [] => Err(HttpError::HttpUriError(UrlError::InvalidCharacter)), | ||||
|             [b'*'] => Ok(RequestUri::Star), | ||||
|             [b'/', ..] => Ok(RequestUri::AbsolutePath(s.to_string())), | ||||
|             bytes if bytes.contains(&b'/') => { | ||||
|                 Ok(RequestUri::AbsoluteUri(try!(Url::parse(s)))) | ||||
|             } | ||||
|             _ => { | ||||
|                 let mut temp = "http://".to_string(); | ||||
|                 temp.push_str(s); | ||||
|                 try!(Url::parse(&temp[..])); | ||||
|                 todo!("compare vs u.authority()"); | ||||
|                 Ok(RequestUri::Authority(s.to_string())) | ||||
|             } | ||||
|  | ||||
|         let bytes = s.as_bytes(); | ||||
|         if bytes == [] { | ||||
|             Err(HttpError::HttpUriError(UrlError::InvalidCharacter)) | ||||
|         } else if bytes == b"*" { | ||||
|             Ok(RequestUri::Star) | ||||
|         } else if bytes.starts_with(b"/") { | ||||
|             Ok(RequestUri::AbsolutePath(s.to_string())) | ||||
|         } else if bytes.contains(&b'/') { | ||||
|             Ok(RequestUri::AbsoluteUri(try!(Url::parse(s)))) | ||||
|         } else { | ||||
|             let mut temp = "http://".to_string(); | ||||
|             temp.push_str(s); | ||||
|             try!(Url::parse(&temp[..])); | ||||
|             todo!("compare vs u.authority()"); | ||||
|             Ok(RequestUri::Authority(s.to_string())) | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user