Rollup merge of #90430 - jkugelman:must-use-std-a-through-n, r=joshtriplett
Add #[must_use] to remaining std functions (A-N) I've run out of compelling reasons to group functions together across crates so I'm just going to go module-by-module. This is half of the remaining items from the `std` crate, from A-N. I added these functions myself. Clippy predictably ignored the `mut` ones, but I don't know why the rest weren't flagged. Check them closely, please? Maybe I overlooked good reasons. ```rust std::backtrace::Backtrace const fn disabled() -> Backtrace; std::backtrace::Backtrace<'a> fn frames(&'a self) -> &'a [BacktraceFrame]; std::collections::hash_map::RawOccupiedEntryMut<'a, K, V> fn key_mut(&mut self) -> &mut K; std::collections::hash_map::RawOccupiedEntryMut<'a, K, V> fn get_mut(&mut self) -> &mut V; std::collections::hash_map::RawOccupiedEntryMut<'a, K, V> fn get_key_value(&mut self) -> (&K, &V); std::collections::hash_map::RawOccupiedEntryMut<'a, K, V> fn get_key_value_mut(&mut self) -> (&mut K, &mut V); std::env fn var_os<K: AsRef<OsStr>>(key: K) -> Option<OsString>; std::env fn split_paths<T: AsRef<OsStr> + ?Sized>(unparsed: &T) -> SplitPaths<'_>; std::io::Error fn get_mut(&mut self) -> Option<&mut (dyn error::Error + Send + Sync + 'static)>; ``` Parent issue: #89692 r? `@joshtriplett`
This commit is contained in:
commit
26f505c433
18 changed files with 68 additions and 14 deletions
|
|
@ -13,8 +13,8 @@ mod bar {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
io::stdout();
|
||||
self::std::io::stdout();
|
||||
foo::my_std::io::stdout();
|
||||
bar::std::io::stdout();
|
||||
let _ = io::stdout();
|
||||
let _ = self::std::io::stdout();
|
||||
let _ = foo::my_std::io::stdout();
|
||||
let _ = bar::std::io::stdout();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,10 +44,10 @@ mod bar {
|
|||
|
||||
fn main() {
|
||||
foo::Foo(());
|
||||
foo::std_io::stdout();
|
||||
let _ = foo::std_io::stdout();
|
||||
foo::local_io(());
|
||||
io::stdout();
|
||||
bar::io::stdout();
|
||||
let _ = io::stdout();
|
||||
let _ = bar::io::stdout();
|
||||
bar::std();
|
||||
bar::std!();
|
||||
|
||||
|
|
@ -56,6 +56,6 @@ fn main() {
|
|||
// scope is allowed, when both resolve to the same definition.
|
||||
use std::io;
|
||||
use io::stdout;
|
||||
stdout();
|
||||
let _ = stdout();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use self::std::io as local_io;
|
|||
|
||||
fn main() {
|
||||
Foo(());
|
||||
std_io::stdout();
|
||||
let _ = std_io::stdout();
|
||||
local_io(());
|
||||
|
||||
{
|
||||
|
|
@ -28,6 +28,6 @@ fn main() {
|
|||
// scope is allowed, when both resolve to the same definition.
|
||||
use ::std::io as std_io;
|
||||
use std_io::stdout;
|
||||
stdout();
|
||||
let _ = stdout();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ mod bar {
|
|||
|
||||
fn main() {
|
||||
foo::Foo(());
|
||||
foo::std_io::stdout();
|
||||
let _ = foo::std_io::stdout();
|
||||
foo::local_io(());
|
||||
io::stdout();
|
||||
bar::io::stdout();
|
||||
let _ = io::stdout();
|
||||
let _ = bar::io::stdout();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,6 @@ m2!();
|
|||
|
||||
fn main() {
|
||||
Foo(());
|
||||
std_io::stdout();
|
||||
let _ = std_io::stdout();
|
||||
local_io(());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue