Suggest as_ref or as_mut
This commit is contained in:
parent
801821d156
commit
84ba2289fd
4 changed files with 5 additions and 5 deletions
|
@ -1089,7 +1089,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||
if is_option_or_result && maybe_reinitialized_locations_is_empty {
|
||||
err.span_suggestion_verbose(
|
||||
fn_call_span.shrink_to_lo(),
|
||||
"consider calling `.as_ref()` to borrow the type's contents",
|
||||
"consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents",
|
||||
"as_ref().",
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
|
|
|
@ -12,7 +12,7 @@ note: this function takes ownership of the receiver `self`, which moves `*cb`
|
|||
|
|
||||
LL | pub const fn map<U, F>(self, f: F) -> Option<U>
|
||||
| ^^^^
|
||||
help: consider calling `.as_ref()` to borrow the type's contents
|
||||
help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents
|
||||
|
|
||||
LL | cb.as_ref().map(|cb| cb());
|
||||
| +++++++++
|
||||
|
|
|
@ -13,7 +13,7 @@ note: this function takes ownership of the receiver `self`, which moves `foo`
|
|||
|
|
||||
LL | pub const fn map<U, F>(self, f: F) -> Option<U>
|
||||
| ^^^^
|
||||
help: consider calling `.as_ref()` to borrow the type's contents
|
||||
help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents
|
||||
|
|
||||
LL | let _x: Option<Struct> = foo.as_ref().map(|s| bar(&s));
|
||||
| +++++++++
|
||||
|
|
|
@ -11,7 +11,7 @@ note: this function takes ownership of the receiver `self`, which moves `selecti
|
|||
|
|
||||
LL | pub const fn unwrap(self) -> T {
|
||||
| ^^^^
|
||||
help: consider calling `.as_ref()` to borrow the type's contents
|
||||
help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents
|
||||
|
|
||||
LL | if selection.1.as_ref().unwrap().contains(selection.0) {
|
||||
| +++++++++
|
||||
|
@ -29,7 +29,7 @@ note: this function takes ownership of the receiver `self`, which moves `selecti
|
|||
|
|
||||
LL | pub fn unwrap(self) -> T
|
||||
| ^^^^
|
||||
help: consider calling `.as_ref()` to borrow the type's contents
|
||||
help: consider calling `.as_ref()` or `.as_mut()` to borrow the type's contents
|
||||
|
|
||||
LL | if selection.1.as_ref().unwrap().contains(selection.0) {
|
||||
| +++++++++
|
||||
|
|
Loading…
Add table
Reference in a new issue