about summary refs log tree commit diff
diff options
context:
space:
mode:
authorareski <areski@gmail.com>2014-10-23 00:44:17 +0200
committerareski <areski@gmail.com>2014-10-23 00:44:17 +0200
commitebdc3046a4419b6d97e1c865705ed59ee1058f5a (patch)
tree518c32f0d018b0d86c00c4c9701733fd9d934aef
parent9f0c29af0263a13c123722122877f818dfec3b8f (diff)
downloadrust-ebdc3046a4419b6d97e1c865705ed59ee1058f5a.tar.gz
rust-ebdc3046a4419b6d97e1c865705ed59ee1058f5a.zip
Fixed single quote around string slice and simplify example
This patch contains a fix for:
- single quote around string slice
- string: String is confusing for newbies and it's more readble if the
  argument name is different that the argument type name
-rw-r--r--src/doc/guide-strings.md12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/doc/guide-strings.md b/src/doc/guide-strings.md
index 44fc0d83044..1c7cb1a3b4e 100644
--- a/src/doc/guide-strings.md
+++ b/src/doc/guide-strings.md
@@ -14,8 +14,8 @@ Rust has two main types of strings: `&str` and `String`.
 
 # &str
 
-The first kind is a `&str`. This is pronounced a 'string slice.' String literals
-are of the type `&str`:
+The first kind is a `&str`. This is pronounced a 'string slice'.
+String literals are of the type `&str`:
 
 ```{rust}
 let string = "Hello there.";
@@ -121,8 +121,8 @@ Both of these lines will print `12`.
 To compare a String to a constant string, prefer `as_slice()`...
 
 ```{rust}
-fn compare(string: String) {
-    if string.as_slice() == "Hello" {
+fn compare(x: String) {
+    if x.as_slice() == "Hello" {
         println!("yes");
     }
 }
@@ -131,8 +131,8 @@ fn compare(string: String) {
 ... over `to_string()`:
 
 ```{rust}
-fn compare(string: String) {
-    if string == "Hello".to_string() {
+fn compare(x: String) {
+    if x == "Hello".to_string() {
         println!("yes");
     }
 }