Skip to content

Commit 175fa91

Browse files
committed
Avoid making the start of a doc code block conditional
Placing the opening triple-backquote inside a `cfg_attr` makes many tools confused, including syntax highlighters (e.g. vim's) and rustfmt. Instead, use a `cfg` inside the doc code block.
1 parent 9dce9db commit 175fa91

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

library/std/src/path.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3259,15 +3259,16 @@ impl Path {
32593259
///
32603260
/// # Examples
32613261
///
3262-
#[cfg_attr(unix, doc = "```no_run")]
3263-
#[cfg_attr(not(unix), doc = "```ignore")]
3262+
/// ```rust,no_run
3263+
/// # #[cfg(unix)] {
32643264
/// use std::path::Path;
32653265
/// use std::os::unix::fs::symlink;
32663266
///
32673267
/// let link_path = Path::new("link");
32683268
/// symlink("/origin_does_not_exist/", link_path).unwrap();
32693269
/// assert_eq!(link_path.is_symlink(), true);
32703270
/// assert_eq!(link_path.exists(), false);
3271+
/// # }
32713272
/// ```
32723273
///
32733274
/// # See Also

0 commit comments

Comments
 (0)