Change:
The example given tries to demonstrate the use of a SipHasher as well as its hash() function. But in doing so, it also creates a new function to display the resulting hash, and this new function is also called hash(). The new function returns a value, while the library hash() function does not. Since many people expect a hash function to return a value, some confusion may occur due to the example function being named exactly the same as the built-in function while being used to do something many may expect (returning a value). This actually came up on IRC. I suggest the function in the example should be called something other than hash(), maybe get_hash(). [alternatively, should the built-in function be called hash, since it's just collecting values and the hashing is done upon finish()?] Another thing: SipHasher appears to be deprecated for direct use. Perhaps this example should use DefaultHasher instead? May be related to .
Thanks for the suggestions! Opened a pull request:
was merged so I'm closing this, please let me know if that's wrong
Nah, looks great. :)

Discussion:
//! # Examples //! //! ```rust <del> //! use std::hash::{Hash, SipHasher, Hasher}; </del> <ins> //! use std::collections::hash_map::DefaultHasher; //! use std::hash::{Hash, Hasher}; </ins> //! //! #[derive(Hash)] //! struct Person {

//!     phone: u64, //! } //! <del> //! let person1 = Person { id: 5, name: "Janet".to_string(), phone: 555_666_7777 }; //! let person2 = Person { id: 5, name: "Bob".to_string(), phone: 555_666_7777 }; </del> <ins> //! let person1 = Person { //!     id: 5, //!     name: "Janet".to_string(), //!     phone: 555_666_7777, //! }; //! let person2 = Person { //!     id: 5, //!     name: "Bob".to_string(), //!     phone: 555_666_7777, //! }; </ins> //! <del> //! assert!(hash(&person1) != hash(&person2)); </del> <ins> //! assert!(calculate_hash(&person1) != calculate_hash(&person2)); </ins> //! <del> //! fn hash<T: Hash>(t: &T) -> u64 { //!     let mut s = SipHasher::new(); </del> <ins> //! fn calculate_hash<T: Hash>(t: &T) -> u64 { //!     let mut s = DefaultHasher::new(); </ins> //!     t.hash(&mut s); //!     s.finish() //! }

//! [`Hash`]: trait.Hash.html //! //! ```rust <del> //! use std::hash::{Hash, Hasher, SipHasher}; </del> <ins> //! use std::collections::hash_map::DefaultHasher; //! use std::hash::{Hash, Hasher}; </ins> //! //! struct Person { //!     id: u32, <del> //! # #[allow(dead_code)] </del> <ins> //!     # #[allow(dead_code)] </ins> //!     name: String, //!     phone: u64, //! }

//!     } //! } //! <del> //! let person1 = Person { id: 5, name: "Janet".to_string(), phone: 555_666_7777 }; //! let person2 = Person { id: 5, name: "Bob".to_string(), phone: 555_666_7777 }; </del> <ins> //! let person1 = Person { //!     id: 5, //!     name: "Janet".to_string(), //!     phone: 555_666_7777, //! }; //! let person2 = Person { //!     id: 5, //!     name: "Bob".to_string(), //!     phone: 555_666_7777, //! }; </ins> //! <del> //! assert_eq!(hash(&person1), hash(&person2)); </del> <ins> //! assert_eq!(calculate_hash(&person1), calculate_hash(&person2)); </ins> //! <del> //! fn hash<T: Hash>(t: &T) -> u64 { //!     let mut s = SipHasher::new(); </del> <ins> //! fn calculate_hash<T: Hash>(t: &T) -> u64 { //!     let mut s = DefaultHasher::new(); </ins> //!     t.hash(&mut s); //!     s.finish() //! }