From 35149bf1cec8707c186e324bf858f7bb9f2692e8 Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Sun, 3 May 2015 17:44:24 +0200 Subject: Clean up HashMap examples --- src/libstd/collections/hash/map.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index ec130e8233a..9d0b0dde74f 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -250,26 +250,26 @@ fn test_resize_policy() { /// book_reviews.insert("The Adventures of Sherlock Holmes", "Eye lyked it alot."); /// /// // check for a specific one. -/// if !book_reviews.contains_key(&("Les Misérables")) { +/// if !book_reviews.contains_key("Les Misérables") { /// println!("We've got {} reviews, but Les Misérables ain't one.", /// book_reviews.len()); /// } /// /// // oops, this review has a lot of spelling mistakes, let's delete it. -/// book_reviews.remove(&("The Adventures of Sherlock Holmes")); +/// book_reviews.remove("The Adventures of Sherlock Holmes"); /// /// // look up the values associated with some keys. /// let to_find = ["Pride and Prejudice", "Alice's Adventure in Wonderland"]; -/// for book in to_find.iter() { +/// for book in &to_find { /// match book_reviews.get(book) { -/// Some(review) => println!("{}: {}", *book, *review), -/// None => println!("{} is unreviewed.", *book) +/// Some(review) => println!("{}: {}", book, review), +/// None => println!("{} is unreviewed.", book) /// } /// } /// /// // iterate over everything. -/// for (book, review) in book_reviews.iter() { -/// println!("{}: \"{}\"", *book, *review); +/// for (book, review) in &book_reviews { +/// println!("{}: \"{}\"", book, review); /// } /// ``` /// @@ -300,7 +300,7 @@ fn test_resize_policy() { /// vikings.insert(Viking::new("Harald", "Iceland"), 12); /// /// // Use derived implementation to print the status of the vikings. -/// for (viking, health) in vikings.iter() { +/// for (viking, health) in &vikings { /// println!("{:?} has {} hp", viking, health); /// } /// ``` -- cgit 1.4.1-3-g733a5 From 6814c2f1aa0b214a9d2767283c57446d0b66fa6f Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Sun, 3 May 2015 18:02:43 +0200 Subject: HashSet Docs: Split First Paragraph This way, the module index renders only the first sentence as a short description. --- src/libstd/collections/hash/set.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index f7e43b38539..9ff3ed88cc4 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -31,10 +31,12 @@ use super::state::HashState; // to get rid of it properly. /// An implementation of a hash set using the underlying representation of a -/// HashMap where the value is (). As with the `HashMap` type, a `HashSet` -/// requires that the elements implement the `Eq` and `Hash` traits. This can -/// frequently be achieved by using `#[derive(Eq, Hash)]`. If you implement -/// these yourself, it is important that the following property holds: +/// HashMap where the value is (). +/// +/// As with the `HashMap` type, a `HashSet` requires that the elements +/// implement the `Eq` and `Hash` traits. This can frequently be achieved by +/// using `#[derive(Eq, Hash)]`. If you implement these yourself, it is +/// important that the following property holds: /// /// ```text /// k1 == k2 -> hash(k1) == hash(k2) -- cgit 1.4.1-3-g733a5 From 1283044a1a48fae610e7b602e0eb876748c7fb73 Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Sun, 3 May 2015 18:06:08 +0200 Subject: Clean up HashSet Examples --- src/libstd/collections/hash/set.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 9ff3ed88cc4..896573cbf8b 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -66,17 +66,17 @@ use super::state::HashState; /// books.insert("The Great Gatsby"); /// /// // Check for a specific one. -/// if !books.contains(&("The Winds of Winter")) { +/// if !books.contains("The Winds of Winter") { /// println!("We have {} books, but The Winds of Winter ain't one.", /// books.len()); /// } /// /// // Remove a book. -/// books.remove(&"The Odyssey"); +/// books.remove("The Odyssey"); /// /// // Iterate over everything. -/// for book in books.iter() { -/// println!("{}", *book); +/// for book in &books { +/// println!("{}", book); /// } /// ``` /// @@ -100,7 +100,7 @@ use super::state::HashState; /// vikings.insert(Viking { name: "Harald", power: 8 }); /// /// // Use derived implementation to print the vikings. -/// for x in vikings.iter() { +/// for x in &vikings { /// println!("{:?}", x); /// } /// ``` -- cgit 1.4.1-3-g733a5 From 5ad6edbe528113640d5a53656fa3601a3dda6cd8 Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Sun, 3 May 2015 21:50:37 +0200 Subject: Fix Derive Notice for HashMap --- src/libstd/collections/hash/map.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 9d0b0dde74f..40d287b1806 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -212,8 +212,9 @@ fn test_resize_policy() { /// overridden with one of the constructors. /// /// It is required that the keys implement the `Eq` and `Hash` traits, although -/// this can frequently be achieved by using `#[derive(Eq, Hash)]`. If you -/// implement these yourself, it is important that the following property holds: +/// this can frequently be achieved by using `#[derive(PartialEq, Eq, Hash)]`. +/// If you implement these yourself, it is important that the following +/// property holds: /// /// ```text /// k1 == k2 -> hash(k1) == hash(k2) -- cgit 1.4.1-3-g733a5 From 2ac380a29492a0f7c481fc839ad723a1488b3e29 Mon Sep 17 00:00:00 2001 From: Pascal Hertleif Date: Sun, 3 May 2015 21:51:41 +0200 Subject: Fix Derive Notice for HashSet --- src/libstd/collections/hash/set.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 896573cbf8b..d6754f10335 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -35,8 +35,8 @@ use super::state::HashState; /// /// As with the `HashMap` type, a `HashSet` requires that the elements /// implement the `Eq` and `Hash` traits. This can frequently be achieved by -/// using `#[derive(Eq, Hash)]`. If you implement these yourself, it is -/// important that the following property holds: +/// using `#[derive(PartialEq, Eq, Hash)]`. If you implement these yourself, +/// it is important that the following property holds: /// /// ```text /// k1 == k2 -> hash(k1) == hash(k2) -- cgit 1.4.1-3-g733a5 From 464069a4bfff2e94cb91c6cc5f0da40bba086bc4 Mon Sep 17 00:00:00 2001 From: Joseph Crail Date: Mon, 4 May 2015 13:21:27 -0400 Subject: Fix spelling errors in documentation. --- src/libcollections/str.rs | 4 ++-- src/libcollections/string.rs | 2 +- src/libcore/str/mod.rs | 2 +- src/librustc/middle/infer/higher_ranked/mod.rs | 2 +- src/librustc/middle/ty.rs | 2 +- src/libstd/macros.rs | 2 +- src/libstd/path.rs | 2 +- src/libsyntax/ast.rs | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/libstd') diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index db9f526a0f2..38431ab5bf1 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -713,7 +713,7 @@ impl str { /// is skipped if empty. /// /// This method can be used for string data that is _terminated_, - /// rather than _seperated_ by a pattern. + /// rather than _separated_ by a pattern. /// /// # Iterator behavior /// @@ -760,7 +760,7 @@ impl str { /// skipped if empty. /// /// This method can be used for string data that is _terminated_, - /// rather than _seperated_ by a pattern. + /// rather than _separated_ by a pattern. /// /// # Iterator behavior /// diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index ad5ed1c89cd..3c668f7fe9b 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -757,7 +757,7 @@ impl FromUtf8Error { #[stable(feature = "rust1", since = "1.0.0")] pub fn into_bytes(self) -> Vec { self.bytes } - /// Accesss the underlying UTF8-error that was the cause of this error. + /// Access the underlying UTF8-error that was the cause of this error. #[stable(feature = "rust1", since = "1.0.0")] pub fn utf8_error(&self) -> Utf8Error { self.error } } diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 6b65d746256..c9bbcba31e9 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -421,7 +421,7 @@ macro_rules! derive_pattern_clone { /// wrapping an private internal one that makes use of the `Pattern` API. /// /// For all patterns `P: Pattern<'a>` the following items will be -/// generated (generics ommitted): +/// generated (generics omitted): /// /// struct $forward_iterator($internal_iterator); /// struct $reverse_iterator($internal_iterator); diff --git a/src/librustc/middle/infer/higher_ranked/mod.rs b/src/librustc/middle/infer/higher_ranked/mod.rs index f347d28b93c..b0940aa7ec0 100644 --- a/src/librustc/middle/infer/higher_ranked/mod.rs +++ b/src/librustc/middle/infer/higher_ranked/mod.rs @@ -461,7 +461,7 @@ impl<'a,'tcx> InferCtxtExt for InferCtxt<'a,'tcx> { /// Constructs and returns a substitution that, for a given type /// scheme parameterized by `generics`, will replace every generic -/// parmeter in the type with a skolemized type/region (which one can +/// parameter in the type with a skolemized type/region (which one can /// think of as a "fresh constant", except at the type/region level of /// reasoning). /// diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 94071ff9190..c80dba6d1fb 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -1908,7 +1908,7 @@ pub enum Predicate<'tcx> { } impl<'tcx> Predicate<'tcx> { - /// Performs a substituion suitable for going from a + /// Performs a substitution suitable for going from a /// poly-trait-ref to supertraits that must hold if that /// poly-trait-ref holds. This is slightly different from a normal /// substitution in terms of what happens with bound regions. See diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index fcebe9c5e98..362296cd133 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -434,7 +434,7 @@ pub mod builtin { /// Parse the current given file as an expression. /// - /// This is generally a bad idea, because it's going to behave unhygenically. + /// This is generally a bad idea, because it's going to behave unhygienically. /// /// # Examples /// diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 2ceb60cc3aa..8ccc387c902 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -358,7 +358,7 @@ pub fn is_separator(c: char) -> bool { c.is_ascii() && is_sep_byte(c as u8) } -/// The primary sperator for the current platform +/// The primary separator for the current platform #[stable(feature = "rust1", since = "1.0.0")] pub const MAIN_SEPARATOR: char = platform::MAIN_SEP; diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 3b7bfb1043a..e00cb82649b 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -595,7 +595,7 @@ pub enum Pat_ { /// An associated const named using the qualified path `::CONST` or /// `::CONST`. Associated consts from inherent impls can be - /// refered to as simply `T::CONST`, in which case they will end up as + /// referred to as simply `T::CONST`, in which case they will end up as /// PatEnum, and the resolver will have to sort that out. PatQPath(QSelf, Path), -- cgit 1.4.1-3-g733a5 From 9b1dd4b35a081ca064d46a9bf799210863661b34 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sun, 3 May 2015 12:28:48 -0700 Subject: std: Fix {atime,mtime,ctime}_nsec accessors These all had a typo where they were accessing the seconds field, not the nanoseconds field. --- src/libstd/sys/unix/ext/fs.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs index 2e4ed38e50f..39910f509f9 100644 --- a/src/libstd/sys/unix/ext/fs.rs +++ b/src/libstd/sys/unix/ext/fs.rs @@ -138,11 +138,11 @@ impl Metadata { pub fn rdev(&self) -> raw::dev_t { self.0.raw().st_rdev as raw::dev_t } pub fn size(&self) -> raw::off_t { self.0.raw().st_size as raw::off_t } pub fn atime(&self) -> raw::time_t { self.0.raw().st_atime } - pub fn atime_nsec(&self) -> c_long { self.0.raw().st_atime } + pub fn atime_nsec(&self) -> c_long { self.0.raw().st_atime_nsec as c_long } pub fn mtime(&self) -> raw::time_t { self.0.raw().st_mtime } - pub fn mtime_nsec(&self) -> c_long { self.0.raw().st_mtime } + pub fn mtime_nsec(&self) -> c_long { self.0.raw().st_mtime_nsec as c_long } pub fn ctime(&self) -> raw::time_t { self.0.raw().st_ctime } - pub fn ctime_nsec(&self) -> c_long { self.0.raw().st_ctime } + pub fn ctime_nsec(&self) -> c_long { self.0.raw().st_ctime_nsec as c_long } pub fn blksize(&self) -> raw::blksize_t { self.0.raw().st_blksize as raw::blksize_t -- cgit 1.4.1-3-g733a5 From 93055587a2927b0c32b2d4e71fa64b3cee97926c Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 4 May 2015 23:05:24 +0200 Subject: doc: fix markup --- src/libstd/net/ip.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index bd0408b21d2..c23259770ca 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -142,7 +142,8 @@ impl Ipv4Addr { /// Returns true if this address is in a range designated for documentation. /// - /// This is defined in RFC 5737 + /// This is defined in RFC 5737: + /// /// - 192.0.2.0/24 (TEST-NET-1) /// - 198.51.100.0/24 (TEST-NET-2) /// - 203.0.113.0/24 (TEST-NET-3) -- cgit 1.4.1-3-g733a5