From 8c34b26606d3cbff5216b1e180236573e304a872 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 18 Feb 2015 05:40:38 -0500 Subject: [PATCH] Update docs by dropping suffixes except where they served to instruct. --- src/doc/intro.md | 4 ++-- src/doc/reference.md | 20 ++++++++------------ src/doc/trpl/concurrency.md | 4 ++-- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/doc/intro.md b/src/doc/intro.md index 90a018c2ddd..d9bfe71e2e4 100644 --- a/src/doc/intro.md +++ b/src/doc/intro.md @@ -480,7 +480,7 @@ use std::sync::{Arc,Mutex}; fn main() { let numbers = Arc::new(Mutex::new(vec![1, 2, 3])); - for i in 0us..3 { + for i in 0..3 { let number = numbers.clone(); Thread::spawn(move || { let mut array = number.lock().unwrap(); @@ -541,7 +541,7 @@ use std::thread::Thread; fn main() { let vec = vec![1, 2, 3]; - for i in 0us..3 { + for i in 0..3 { Thread::spawn(move || { println!("{}", vec[i]); }); diff --git a/src/doc/reference.md b/src/doc/reference.md index 00ed5d4562b..70baebf0d30 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -465,13 +465,9 @@ An _integer literal_ has one of four forms: Like any literal, an integer literal may be followed (immediately, without any spaces) by an _integer suffix_, which forcibly sets the -type of the literal. There are 10 valid values for an integer suffix: - -* Each of the signed and unsigned machine types `u8`, `i8`, - `u16`, `i16`, `u32`, `i32`, `u64` and `i64` - give the literal the corresponding machine type. -* The `is` and `us` suffixes give the literal type `isize` or `usize`, - respectively. +type of the literal. The integer suffix must be the name of one of the +integral types: `u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `u64`, `i64`, +`isize`, or `usize`. The type of an _unsuffixed_ integer literal is determined by type inference. If an integer type can be _uniquely_ determined from the surrounding program @@ -489,7 +485,7 @@ Examples of integer literals of various forms: 0xff_u8; // type u8 0o70_i16; // type i16 0b1111_1111_1001_0000_i32; // type i32 -0us; // type usize +0usize; // type usize ``` ##### Floating-point literals @@ -1001,8 +997,8 @@ fn foo(_: T){} fn bar(map1: HashMap, map2: hash_map::HashMap){} fn main() { - // Equivalent to 'std::iter::range_step(0us, 10, 2);' - range_step(0us, 10, 2); + // Equivalent to 'std::iter::range_step(0, 10, 2);' + range_step(0, 10, 2); // Equivalent to 'foo(vec![std::option::Option::Some(1.0f64), // std::option::Option::None]);' @@ -3126,7 +3122,7 @@ conditional expression evaluates to `false`, the `while` expression completes. An example: ``` -let mut i = 0us; +let mut i = 0; while i < 10 { println!("hello"); @@ -3206,7 +3202,7 @@ An example of a for loop over a series of integers: ``` # fn bar(b:usize) { } -for i in 0us..256 { +for i in 0..256 { bar(i); } ``` diff --git a/src/doc/trpl/concurrency.md b/src/doc/trpl/concurrency.md index 9f8f76e1fea..842957bd601 100644 --- a/src/doc/trpl/concurrency.md +++ b/src/doc/trpl/concurrency.md @@ -244,7 +244,7 @@ use std::time::Duration; fn main() { let data = Arc::new(Mutex::new(vec![1u32, 2, 3])); - for i in 0us..2 { + for i in 0..2 { let data = data.clone(); thread::spawn(move || { let mut data = data.lock().unwrap(); @@ -267,7 +267,7 @@ thread more closely: # use std::time::Duration; # fn main() { # let data = Arc::new(Mutex::new(vec![1u32, 2, 3])); -# for i in 0us..2 { +# for i in 0..2 { # let data = data.clone(); thread::spawn(move || { let mut data = data.lock().unwrap();