Skip to content

Commit ab48de8

Browse files
committed
Use cfg! instead of #[cfg]
1 parent e0f0fd0 commit ab48de8

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/libstd/path.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -327,14 +327,7 @@ unsafe fn u8_slice_as_os_str(s: &[u8]) -> &OsStr {
327327
#[inline]
328328
#[allow(unused_variables)]
329329
fn has_scheme(s: &[u8]) -> bool {
330-
#[cfg(target_os = "redox")]
331-
{
332-
s.split(|b| *b == b'/').next().unwrap_or(b"").contains(&b':')
333-
}
334-
#[cfg(not(target_os = "redox"))]
335-
{
336-
false
337-
}
330+
cfg!(target_os = "redox") && s.split(|b| *b == b'/').next().unwrap_or(b"").contains(&b':')
338331
}
339332

340333
////////////////////////////////////////////////////////////////////////////////
@@ -1702,12 +1695,9 @@ impl Path {
17021695
#[stable(feature = "rust1", since = "1.0.0")]
17031696
#[allow(deprecated)]
17041697
pub fn is_absolute(&self) -> bool {
1705-
#[cfg(not(target_os = "redox"))]
1706-
{
1698+
if !cfg!(target_os = "redox") {
17071699
self.has_root() && (cfg!(unix) || self.prefix().is_some())
1708-
}
1709-
#[cfg(target_os = "redox")]
1710-
{
1700+
} else {
17111701
// FIXME: Allow Redox prefixes
17121702
has_scheme(self.as_u8_slice())
17131703
}

0 commit comments

Comments
 (0)