diff options
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 21 | ||||
| -rw-r--r-- | src/libstd/collections/hash/set.rs | 20 | ||||
| -rw-r--r-- | src/libstd/macros.rs | 2 | ||||
| -rw-r--r-- | src/libstd/net/ip.rs | 3 | ||||
| -rw-r--r-- | src/libstd/path.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/unix/ext/fs.rs | 6 |
6 files changed, 29 insertions, 25 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index f82c1653be1..eedda3cf437 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) @@ -250,26 +251,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 +301,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); /// } /// ``` diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index f7e43b38539..d6754f10335 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(PartialEq, Eq, Hash)]`. If you implement these yourself, +/// it is important that the following property holds: /// /// ```text /// k1 == k2 -> hash(k1) == hash(k2) @@ -64,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); /// } /// ``` /// @@ -98,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); /// } /// ``` 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/net/ip.rs b/src/libstd/net/ip.rs index bdf81d8cd6a..bc13d966a10 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) 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/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 |
