about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-03-23 12:33:04 -0700
committerbors <bors@rust-lang.org>2016-03-23 12:33:04 -0700
commit98f0a9128f0fc6545de14a5de8f0e91675045e56 (patch)
tree07e04a07ac24db795165e0fa2f62c65797d5c57e /src/libstd
parentb76f818cad31c7910fb6f0fa5e628dbaf4db1108 (diff)
parent2e9b40f57638303d81eb9731784732e6491f0082 (diff)
downloadrust-98f0a9128f0fc6545de14a5de8f0e91675045e56.tar.gz
rust-98f0a9128f0fc6545de14a5de8f0e91675045e56.zip
Auto merge of #32454 - eddyb:rollup, r=eddyb
Rollup of 11 pull requests

- Successful merges: #32404, #32420, #32423, #32425, #32429, #32430, #32431, #32434, #32437, #32441, #32443
- Failed merges:
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/ffi/os_str.rs28
-rw-r--r--src/libstd/net/addr.rs12
-rw-r--r--src/libstd/primitive_docs.rs6
3 files changed, 37 insertions, 9 deletions
diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs
index 46f2d3a6418..de840457a01 100644
--- a/src/libstd/ffi/os_str.rs
+++ b/src/libstd/ffi/os_str.rs
@@ -173,6 +173,14 @@ impl ops::Deref for OsString {
     }
 }
 
+#[stable(feature = "osstring_default", since = "1.9.0")]
+impl Default for OsString {
+    #[inline]
+    fn default() -> OsString {
+        OsString::new()
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl Debug for OsString {
     fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
@@ -302,6 +310,14 @@ impl OsStr {
     }
 }
 
+#[stable(feature = "osstring_default", since = "1.9.0")]
+impl<'a> Default for &'a OsStr {
+    #[inline]
+    fn default() -> &'a OsStr {
+        OsStr::new("")
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl PartialEq for OsStr {
     fn eq(&self, other: &OsStr) -> bool {
@@ -555,6 +571,12 @@ mod tests {
     }
 
     #[test]
+    fn test_os_string_default() {
+        let os_string: OsString = Default::default();
+        assert_eq!("", &os_string);
+    }
+
+    #[test]
     fn test_os_str_is_empty() {
         let mut os_string = OsString::new();
         assert!(os_string.is_empty());
@@ -577,4 +599,10 @@ mod tests {
         os_string.clear();
         assert_eq!(0, os_string.len());
     }
+
+    #[test]
+    fn test_os_str_default() {
+        let os_str: &OsStr = Default::default();
+        assert_eq!("", os_str);
+    }
 }
diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs
index 273a2004fc0..a915872d8ac 100644
--- a/src/libstd/net/addr.rs
+++ b/src/libstd/net/addr.rs
@@ -143,8 +143,8 @@ impl SocketAddrV6 {
                 sin6_family: c::AF_INET6 as c::sa_family_t,
                 sin6_port: hton(port),
                 sin6_addr: *ip.as_inner(),
-                sin6_flowinfo: hton(flowinfo),
-                sin6_scope_id: hton(scope_id),
+                sin6_flowinfo: flowinfo,
+                sin6_scope_id: scope_id,
                 .. unsafe { mem::zeroed() }
             },
         }
@@ -173,23 +173,23 @@ impl SocketAddrV6 {
     /// Returns the flow information associated with this address,
     /// corresponding to the `sin6_flowinfo` field in C.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn flowinfo(&self) -> u32 { ntoh(self.inner.sin6_flowinfo) }
+    pub fn flowinfo(&self) -> u32 { self.inner.sin6_flowinfo }
 
     /// Change the flow information associated with this socket address.
     #[unstable(feature = "sockaddr_setters", reason = "recent addition", issue = "31572")]
     pub fn set_flowinfo(&mut self, new_flowinfo: u32) {
-        self.inner.sin6_flowinfo = hton(new_flowinfo)
+        self.inner.sin6_flowinfo = new_flowinfo;
     }
 
     /// Returns the scope ID associated with this address,
     /// corresponding to the `sin6_scope_id` field in C.
     #[stable(feature = "rust1", since = "1.0.0")]
-    pub fn scope_id(&self) -> u32 { ntoh(self.inner.sin6_scope_id) }
+    pub fn scope_id(&self) -> u32 { self.inner.sin6_scope_id }
 
     /// Change the scope ID associated with this socket address.
     #[unstable(feature = "sockaddr_setters", reason = "recent addition", issue = "31572")]
     pub fn set_scope_id(&mut self, new_scope_id: u32) {
-        self.inner.sin6_scope_id = hton(new_scope_id)
+        self.inner.sin6_scope_id = new_scope_id;
     }
 }
 
diff --git a/src/libstd/primitive_docs.rs b/src/libstd/primitive_docs.rs
index 65ed879c4ad..c8ea28c5ca3 100644
--- a/src/libstd/primitive_docs.rs
+++ b/src/libstd/primitive_docs.rs
@@ -77,7 +77,7 @@ mod prim_bool { }
 /// # Representation
 ///
 /// `char` is always four bytes in size. This is a different representation than
-/// a given character would have as part of a [`String`], for example:
+/// a given character would have as part of a [`String`]. For example:
 ///
 /// ```
 /// let v = vec!['h', 'e', 'l', 'l', 'o'];
@@ -116,8 +116,8 @@ mod prim_bool { }
 ///             ^~
 /// ```
 ///
-/// Another implication of the 4-byte fixed size of a `char`, is that
-/// per-`char`acter processing can end up using a lot more memory:
+/// Another implication of the 4-byte fixed size of a `char` is that
+/// per-`char` processing can end up using a lot more memory:
 ///
 /// ```
 /// let s = String::from("love: ❤️");