diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2021-02-25 16:06:21 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-25 16:06:21 -0500 |
| commit | befa2dffdafe77fdd344690558f1334e721b42db (patch) | |
| tree | 0061636d949683d72fa90bc55212c68f29325280 /library/std/src/sys | |
| parent | 503d50b94cb7864d126131a538913f8ab83bd6bc (diff) | |
| parent | eefec8abda7cb8e8693aa876fbd1e21f2a6a5c2d (diff) | |
| download | rust-befa2dffdafe77fdd344690558f1334e721b42db.tar.gz rust-befa2dffdafe77fdd344690558f1334e721b42db.zip | |
Rollup merge of #82467 - ojeda:tidy-normalize-safety-comments, r=kennytm
library: Normalize safety-for-unsafe-block comments Almost all safety comments are of the form `// SAFETY:`, so normalize the rest and fix a few of them that should have been a `/// # Safety` section instead. Furthermore, make `tidy` only allow the uppercase form. While currently `tidy` only checks `core`, it is a good idea to prevent `core` from drifting to non-uppercase comments, so that later we can start checking `alloc` etc. too. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'library/std/src/sys')
| -rw-r--r-- | library/std/src/sys/windows/path.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/library/std/src/sys/windows/path.rs b/library/std/src/sys/windows/path.rs index c10c0df4a3a..b8f512f6a23 100644 --- a/library/std/src/sys/windows/path.rs +++ b/library/std/src/sys/windows/path.rs @@ -8,7 +8,9 @@ mod tests; pub const MAIN_SEP_STR: &str = "\\"; pub const MAIN_SEP: char = '\\'; -// Safety: `bytes` must be a valid wtf8 encoded slice +/// # Safety +/// +/// `bytes` must be a valid wtf8 encoded slice #[inline] unsafe fn bytes_as_os_str(bytes: &[u8]) -> &OsStr { // &OsStr is layout compatible with &Slice, which is compatible with &Wtf8, @@ -130,7 +132,7 @@ fn parse_next_component(path: &OsStr, verbatim: bool) -> (&OsStr, &OsStr) { // The max `separator_end` is `bytes.len()` and `bytes[bytes.len()..]` is a valid index. let path = &path.bytes()[separator_end..]; - // Safety: `path` is a valid wtf8 encoded slice and each of the separators ('/', '\') + // SAFETY: `path` is a valid wtf8 encoded slice and each of the separators ('/', '\') // is encoded in a single byte, therefore `bytes[separator_start]` and // `bytes[separator_end]` must be code point boundaries and thus // `bytes[..separator_start]` and `bytes[separator_end..]` are valid wtf8 slices. |
