diff --git a/src/doc/complement-design-faq.md b/src/doc/complement-design-faq.md index e0a56a1a631d4..e887ed0cc5297 100644 --- a/src/doc/complement-design-faq.md +++ b/src/doc/complement-design-faq.md @@ -160,7 +160,7 @@ that all delimiters be balanced. ## `->` for function return type This is to make the language easier to parse for humans, especially in the face -of higher-order functions. `fn foo(f: fn(int): int, fn(T): U): U` is not +of higher-order functions. `fn foo(f: fn(i32): i32, fn(T): U): U` is not particularly easy to read. ## Why is `let` used to introduce variables? diff --git a/src/doc/style/errors/ergonomics.md b/src/doc/style/errors/ergonomics.md index d2fcf27e93cdf..d530301a90939 100644 --- a/src/doc/style/errors/ergonomics.md +++ b/src/doc/style/errors/ergonomics.md @@ -14,8 +14,8 @@ use std::io::{File, Open, Write, IoError}; struct Info { name: String, - age: int, - rating: int + age: i32, + rating: i32 } fn write_info(info: &Info) -> Result<(), IoError> { @@ -36,8 +36,8 @@ use std::io::{File, Open, Write, IoError}; struct Info { name: String, - age: int, - rating: int + age: i32, + rating: i32 } fn write_info(info: &Info) -> Result<(), IoError> { diff --git a/src/doc/style/features/functions-and-methods/input.md b/src/doc/style/features/functions-and-methods/input.md index b0912ea0203dc..9b9500008c2f6 100644 --- a/src/doc/style/features/functions-and-methods/input.md +++ b/src/doc/style/features/functions-and-methods/input.md @@ -57,15 +57,15 @@ it becomes. Prefer ```rust -fn foo>(c: T) { ... } +fn foo>(c: T) { ... } ``` over any of ```rust -fn foo(c: &[int]) { ... } -fn foo(c: &Vec) { ... } -fn foo(c: &SomeOtherCollection) { ... } +fn foo(c: &[i32]) { ... } +fn foo(c: &Vec) { ... } +fn foo(c: &SomeOtherCollection) { ... } ``` if the function only needs to iterate over the data. @@ -121,7 +121,7 @@ The primary exception: sometimes a function is meant to modify data that the caller already owns, for example to re-use a buffer: ```rust -fn read(&mut self, buf: &mut [u8]) -> IoResult +fn read(&mut self, buf: &mut [u8]) -> IoResult ``` (From the [Reader trait](http://static.rust-lang.org/doc/master/std/io/trait.Reader.html#tymethod.read).) diff --git a/src/doc/style/features/functions-and-methods/output.md b/src/doc/style/features/functions-and-methods/output.md index a83e2b76bcb7f..3e43d1e416d76 100644 --- a/src/doc/style/features/functions-and-methods/output.md +++ b/src/doc/style/features/functions-and-methods/output.md @@ -19,7 +19,7 @@ Prefer ```rust struct SearchResult { found: bool, // item in container? - expected_index: uint // what would the item's index be? + expected_index: usize // what would the item's index be? } fn binary_search(&self, k: Key) -> SearchResult @@ -27,7 +27,7 @@ fn binary_search(&self, k: Key) -> SearchResult or ```rust -fn binary_search(&self, k: Key) -> (bool, uint) +fn binary_search(&self, k: Key) -> (bool, usize) ``` over diff --git a/src/doc/style/features/let.md b/src/doc/style/features/let.md index 87117a20d7a49..f13a84f6fee86 100644 --- a/src/doc/style/features/let.md +++ b/src/doc/style/features/let.md @@ -5,7 +5,7 @@ Prefer ```rust -fn use_mutex(m: sync::mutex::Mutex) { +fn use_mutex(m: sync::mutex::Mutex) { let guard = m.lock(); do_work(guard); drop(guard); // unlock the lock @@ -16,7 +16,7 @@ fn use_mutex(m: sync::mutex::Mutex) { over ```rust -fn use_mutex(m: sync::mutex::Mutex) { +fn use_mutex(m: sync::mutex::Mutex) { do_work(m.lock()); // do other work } diff --git a/src/doc/style/features/traits/reuse.md b/src/doc/style/features/traits/reuse.md index 6735023ae6800..61f8db87cde89 100644 --- a/src/doc/style/features/traits/reuse.md +++ b/src/doc/style/features/traits/reuse.md @@ -15,7 +15,7 @@ trait Printable { fn print(&self) { println!("{:?}", *self) } } -impl Printable for int {} +impl Printable for i32 {} impl Printable for String { fn print(&self) { println!("{}", *self) } diff --git a/src/doc/style/features/types/newtype.md b/src/doc/style/features/types/newtype.md index 60c17fc2a52e2..e69aa3b83bfa4 100644 --- a/src/doc/style/features/types/newtype.md +++ b/src/doc/style/features/types/newtype.md @@ -43,12 +43,12 @@ promises to the client. For example, consider a function `my_transform` that returns a compound iterator type `Enumerate>>`. We wish to hide this type from the -client, so that the client's view of the return type is roughly `Iterator<(uint, +client, so that the client's view of the return type is roughly `Iterator<(usize, T)>`. We can do so using the newtype pattern: ```rust struct MyTransformResult(Enumerate>>); -impl Iterator<(uint, T)> for MyTransformResult { ... } +impl Iterator<(usize, T)> for MyTransformResult { ... } fn my_transform>(iter: Iter) -> MyTransformResult { ... diff --git a/src/doc/style/style/features.md b/src/doc/style/style/features.md index f73517c2b9c3b..b5d0b484ccda5 100644 --- a/src/doc/style/style/features.md +++ b/src/doc/style/style/features.md @@ -3,7 +3,7 @@ Terminate `return` statements with semicolons: ``` rust -fn foo(bar: int) -> Option { +fn foo(bar: i32) -> Option { if some_condition() { return None; } diff --git a/src/doc/style/style/imports.md b/src/doc/style/style/imports.md index 207a3fd7f8d16..cf3fd4163a26e 100644 --- a/src/doc/style/style/imports.md +++ b/src/doc/style/style/imports.md @@ -44,7 +44,7 @@ For example: use option::Option; use mem; -let i: int = mem::transmute(Option(0)); +let i: isize = mem::transmute(Option(0)); ``` > **[FIXME]** Add rationale. diff --git a/src/doc/style/style/whitespace.md b/src/doc/style/style/whitespace.md index b21b280dff0d7..c28a723209563 100644 --- a/src/doc/style/style/whitespace.md +++ b/src/doc/style/style/whitespace.md @@ -10,7 +10,7 @@ ``` rust #[deprecated = "Use `bar` instead."] -fn foo(a: uint, b: uint) -> uint { +fn foo(a: usize, b: usize) -> usize { a + b } ``` diff --git a/src/doc/trpl/associated-types.md b/src/doc/trpl/associated-types.md index 55e2787cc2591..ec96880f12a95 100644 --- a/src/doc/trpl/associated-types.md +++ b/src/doc/trpl/associated-types.md @@ -43,7 +43,7 @@ trait Graph { Now, our clients can be abstract over a given `Graph`: ```rust,ignore -fn distance(graph: &G, start: &G::N, end: &G::N) -> uint { ... } +fn distance(graph: &G, start: &G::N, end: &G::N) -> usize { ... } ``` No need to deal with the `E`dge type here! diff --git a/src/doc/trpl/box-syntax-and-patterns.md b/src/doc/trpl/box-syntax-and-patterns.md index 1cf84bfd658c0..8d83b64d68313 100644 --- a/src/doc/trpl/box-syntax-and-patterns.md +++ b/src/doc/trpl/box-syntax-and-patterns.md @@ -58,7 +58,7 @@ fn main() { ``` The idea is that by passing around a box, you're only copying a pointer, rather -than the hundred `int`s that make up the `BigStruct`. +than the hundred `i32`s that make up the `BigStruct`. This is an antipattern in Rust. Instead, write this: diff --git a/src/doc/trpl/traits.md b/src/doc/trpl/traits.md index efa16f2942f06..9ac170ddec298 100644 --- a/src/doc/trpl/traits.md +++ b/src/doc/trpl/traits.md @@ -146,7 +146,7 @@ print_area(5); We get a compile-time error: ```text -error: failed to find an implementation of trait main::HasArea for int +error: the trait `HasArea` is not implemented for the type `_` [E0277] ``` So far, we’ve only added trait implementations to structs, but you can