]> git.lizzy.rs Git - rust.git/commitdiff
Use cfg! instead of #[cfg]
authorIan Douglas Scott <ian@iandouglasscott.com>
Tue, 22 Aug 2017 15:17:05 +0000 (08:17 -0700)
committerIan Douglas Scott <ian@iandouglasscott.com>
Tue, 22 Aug 2017 15:17:05 +0000 (08:17 -0700)
src/libstd/path.rs

index 5757d447c54d0d6a8ab2c4f2699a3cd11c0d7233..32e1781c3c45c0d9a14ed9a8e540a3c75cc2e1c4 100644 (file)
@@ -327,14 +327,7 @@ unsafe fn u8_slice_as_os_str(s: &[u8]) -> &OsStr {
 #[inline]
 #[allow(unused_variables)]
 fn has_scheme(s: &[u8]) -> bool {
-    #[cfg(target_os = "redox")]
-    {
-        s.split(|b| *b == b'/').next().unwrap_or(b"").contains(&b':')
-    }
-    #[cfg(not(target_os = "redox"))]
-    {
-        false
-    }
+    cfg!(target_os = "redox") && s.split(|b| *b == b'/').next().unwrap_or(b"").contains(&b':')
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1702,12 +1695,9 @@ pub fn to_path_buf(&self) -> PathBuf {
     #[stable(feature = "rust1", since = "1.0.0")]
     #[allow(deprecated)]
     pub fn is_absolute(&self) -> bool {
-        #[cfg(not(target_os = "redox"))]
-        {
+        if !cfg!(target_os = "redox") {
             self.has_root() && (cfg!(unix) || self.prefix().is_some())
-        }
-        #[cfg(target_os = "redox")]
-        {
+        } else {
             // FIXME: Allow Redox prefixes
             has_scheme(self.as_u8_slice())
         }