]> git.lizzy.rs Git - rust.git/blobdiff - src/test/run-pass/estr-slice.rs
Rollup merge of #45171 - rust-lang:petrochenkov-patch-2, r=steveklabnik
[rust.git] / src / test / run-pass / estr-slice.rs
index 2d33ac4e5dea0162c8638141f864809bbf9234fd..5364cdc627f50b1f95d9304ef8c0756c1c2b89cb 100644 (file)
 
 
 pub fn main() {
-    let x = &"hello";
-    let v = &"hello";
-    let y : &str = &"there";
+    let x = "hello";
+    let v = "hello";
+    let y : &str = "there";
 
     println!("{}", x);
     println!("{}", y);
 
-    assert_eq!(x[0], 'h' as u8);
-    assert_eq!(x[4], 'o' as u8);
+    assert_eq!(x.as_bytes()[0], 'h' as u8);
+    assert_eq!(x.as_bytes()[4], 'o' as u8);
 
-    let z : &str = &"thing";
+    let z : &str = "thing";
     assert_eq!(v, x);
     assert!(x != z);
 
-    let a = &"aaaa";
-    let b = &"bbbb";
+    let a = "aaaa";
+    let b = "bbbb";
 
-    let c = &"cccc";
-    let cc = &"ccccc";
+    let c = "cccc";
+    let cc = "ccccc";
 
     println!("{}", a);