Add rustc_confusables
annotations to some stdlib APIs
Help with common API confusion, like asking for `push` when the data structure really has `append`. ``` error[E0599]: no method named `size` found for struct `Vec<{integer}>` in the current scope --> $DIR/rustc_confusables_std_cases.rs:17:7 | LL | x.size(); | ^^^^ | help: you might have meant to use `len` | LL | x.len(); | ~~~ help: there is a method with a similar name | LL | x.resize(); | ~~~~~~ ``` #59450
This commit is contained in:
parent
933a05bd0b
commit
e5b3c7ef14
20 changed files with 180 additions and 29 deletions
|
@ -1270,6 +1270,7 @@ impl PathBuf {
|
|||
/// assert_eq!(path, PathBuf::from("/etc"));
|
||||
/// ```
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_confusables("append", "put")]
|
||||
pub fn push<P: AsRef<Path>>(&mut self, path: P) {
|
||||
self._push(path.as_ref())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue