about summary refs log tree commit diff
path: root/library/std/src/sys_common/wtf8/tests.rs
AgeCommit message (Collapse)AuthorLines
2025-08-20Copy WTF-8 code into core/alloc (for better diffs)ltdk-751/+0
2025-02-08Rustfmtbjorn3-55/+56
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-56/+55
2024-06-25std: test a variety of ways to extend a Wtf8BufJubilee Young-0/+24
2024-01-21Move `OsStr::slice_encoded_bytes` validation to platform modulesJan Verbeek-0/+62
On Windows and UEFI this improves performance and error messaging. On other platforms we optimize the fast path a bit more. This also prepares for later relaxing the checks on certain platforms.
2023-12-10remove redundant importssurechen-1/+0
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-06-14Rollup merge of #98202 - aticu:impl_tryfrom_osstr_for_str, r=AmanieuMatthias Krüger-3/+3
Implement `TryFrom<&OsStr>` for `&str` Recently when trying to work with `&OsStr` I was surprised to find this `impl` missing. Since the `to_str` method already existed the actual implementation is fairly non-controversial, except for maybe the choice of the error type. I chose an opaque error here instead of something like `std::str::Utf8Error`, since that would already make a number of assumption about the underlying implementation of `OsStr`. As this is a trait implementation, it is insta-stable, if I'm not mistaken? Either way this will need an FCP. I chose "1.64.0" as the version, since this is unlikely to land before the beta cut-off. `@rustbot` modify labels: +T-libs-api API Change Proposal: rust-lang/rust#99031 (accepted)
2023-06-12Implement `TryFrom<&OsStr>` for `&str`aticu-3/+3
2022-06-23Remove `is_known_utf8` checks from more tests where it's no longer set.Dan Gohman-4/+0
2022-06-23Don't eagerly scan for `is_known_utf8` in `to_ascii_lowercase`/`uppercase`.Dan Gohman-4/+0
2022-06-23Optimize `Wtf8Buf::into_string` for the case where it contains UTF-8.Dan Gohman-19/+284
Add a `is_known_utf8` flag to `Wtf8Buf`, which tracks whether the string is known to contain UTF-8. This is efficiently computed in many common situations, such as when a `Wtf8Buf` is constructed from a `String` or `&str`, or with `Wtf8Buf::from_wide` which is already doing UTF-16 decoding and already checking for surrogates. This makes `OsString::into_string` O(1) rather than O(N) on Windows in common cases. And, it eliminates the need to scan through the string for surrogates in `Args::next` and `Vars::next`, because the strings are already being translated with `Wtf8Buf::from_wide`. Many things on Windows construct `OsString`s with `Wtf8Buf::from_wide`, such as `DirEntry::file_name` and `fs::read_link`, so with this patch, users of those functions can subsequently call `.into_string()` without paying for an extra scan through the string for surrogates.
2022-03-10Use implicit capture syntax in format_argsT-O-R-U-S-2/+2
This updates the standard library's documentation to use the new syntax. The documentation is worthwhile to update as it should be more idiomatic (particularly for features like this, which are nice for users to get acquainted with). The general codebase is likely more hassle than benefit to update: it'll hurt git blame, and generally updates can be done by folks updating the code if (and when) that makes things more readable with the new format. A few places in the compiler and library code are updated (mostly just due to already having been done when this commit was first authored).
2021-06-20Auto merge of #86463 - fee1-dead:fixed-encode_wide, r=m-ou-sebors-0/+12
Account for self.extra in size_hint for EncodeWide Fixes #86414.
2021-06-19Account for self.extra in size_hint for EncodeWideDeadbeef-0/+12
2021-06-18Lint for unused borrows as part of UNUSED_MUST_USEhi-rustin-3/+3
2020-08-31std: move "mod tests/benches" to separate filesLzu Tao-0/+397
Also doing fmt inplace as requested.