fix(rustup): Remove uses of the obsolete &a[] syntax
This commit is contained in:
		
				
					committed by
					
						 Sean McArthur
						Sean McArthur
					
				
			
			
				
	
			
			
			
						parent
						
							234fcdc3a2
						
					
				
				
					commit
					039e984f68
				
			| @@ -29,7 +29,7 @@ impl<S: Scheme + 'static> Header for Authorization<S> { | ||||
|  | ||||
|     fn parse_header(raw: &[Vec<u8>]) -> Option<Authorization<S>> { | ||||
|         if raw.len() == 1 { | ||||
|             match (from_utf8(unsafe { &raw[].get_unchecked(0)[] }), Scheme::scheme(None::<S>)) { | ||||
|             match (from_utf8(unsafe { &raw.get_unchecked(0)[..] }), Scheme::scheme(None::<S>)) { | ||||
|                 (Ok(header), Some(scheme)) | ||||
|                     if header.starts_with(scheme) && header.len() > scheme.len() + 1 => { | ||||
|                     header[scheme.len() + 1..].parse::<S>().map(|s| Authorization(s)).ok() | ||||
| @@ -96,7 +96,7 @@ impl Scheme for Basic { | ||||
|         let mut text = self.username.clone(); | ||||
|         text.push(':'); | ||||
|         if let Some(ref pass) = self.password { | ||||
|             text.push_str(&pass[]); | ||||
|             text.push_str(&pass[..]); | ||||
|         } | ||||
|         write!(f, "{}", text.as_bytes().to_base64(Config { | ||||
|             char_set: Standard, | ||||
| @@ -113,7 +113,7 @@ impl FromStr for Basic { | ||||
|         match s.from_base64() { | ||||
|             Ok(decoded) => match String::from_utf8(decoded) { | ||||
|                 Ok(text) => { | ||||
|                     let mut parts = &mut text[].split(':'); | ||||
|                     let mut parts = &mut text.split(':'); | ||||
|                     let user = match parts.next() { | ||||
|                         Some(part) => part.to_string(), | ||||
|                         None => return Err(()) | ||||
| @@ -160,7 +160,7 @@ mod tests { | ||||
|     #[test] | ||||
|     fn test_raw_auth_parse() { | ||||
|         let headers = Headers::from_raw(&mut mem("Authorization: foo bar baz\r\n\r\n")).unwrap(); | ||||
|         assert_eq!(&headers.get::<Authorization<String>>().unwrap().0[], "foo bar baz"); | ||||
|         assert_eq!(&headers.get::<Authorization<String>>().unwrap().0[..], "foo bar baz"); | ||||
|     } | ||||
|  | ||||
|     #[test] | ||||
| @@ -181,7 +181,7 @@ mod tests { | ||||
|     fn test_basic_auth_parse() { | ||||
|         let headers = Headers::from_raw(&mut mem("Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\r\n\r\n")).unwrap(); | ||||
|         let auth = headers.get::<Authorization<Basic>>().unwrap(); | ||||
|         assert_eq!(&auth.0.username[], "Aladdin"); | ||||
|         assert_eq!(&auth.0.username[..], "Aladdin"); | ||||
|         assert_eq!(auth.0.password, Some("open sesame".to_string())); | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user