Files
rust/library/std/src
Matthias Krüger ce76292014 Rollup merge of #137051 - thaliaarchi:io-optional-impls/empty, r=m-ou-se
Implement default methods for `io::Empty` and `io::Sink`

Implements default methods of `io::Read`, `io::BufRead`, and `io::Write` for `io::Empty` and `io::Sink`. These implementations are equivalent to the defaults, except in doing less unnecessary work.

`Read::read_to_string` and `BufRead::read_line` both have a redundant call to `str::from_utf8` which can't be inlined from `core` and `Write::write_all_vectored` has slicing logic which can't be simplified (See on [Compiler Explorer](https://rust.godbolt.org/z/KK6xcrWr4)). The rest are optimized to the minimal with `-C opt-level=3`, but this PR gives that benefit to unoptimized builds.

This includes an implementation of `Write::write_fmt` which just ignores the `fmt::Arguments<'_>`. This could be problematic whenever a user formatting impl is impure, but the docs do not guarantee that the args will be expanded.

Tracked in https://github.com/rust-lang/rust/issues/136756.

r? `@m-ou-se`
2025-03-19 16:52:53 +01:00
..
2024-11-02 11:27:14 +01:00
2025-02-13 13:10:28 -08:00
2025-03-08 16:22:37 -08:00
2025-01-11 06:35:21 +02:00
2025-03-10 10:00:25 -07:00
2025-03-11 09:46:34 -07:00
2025-02-25 09:08:22 +05:30
2025-03-13 20:09:07 +00:00
2025-03-10 21:23:32 +08:00
2025-02-07 16:54:07 +01:00