Skip to content

Commit 59634bc

Browse files
committed
Replace deref with as_deref
1 parent f2a9721 commit 59634bc

File tree

10 files changed

+11
-11
lines changed

10 files changed

+11
-11
lines changed

Diff for: src/librustc/hir/print.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ impl<'a> State<'a> {
941941
self.maybe_print_comment(st.span.lo());
942942
match st.node {
943943
hir::StmtKind::Local(ref loc) => {
944-
self.print_local(loc.init.deref(), |this| this.print_local_decl(&loc));
944+
self.print_local(loc.init.as_deref(), |this| this.print_local_decl(&loc));
945945
}
946946
hir::StmtKind::Item(item) => {
947947
self.ann.nested(self, Nested::Item(item))

Diff for: src/librustc_typeck/check/expr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
226226
tcx.mk_unit()
227227
}
228228
ExprKind::Break(destination, ref expr_opt) => {
229-
self.check_expr_break(destination, expr_opt.deref(), expr)
229+
self.check_expr_break(destination, expr_opt.as_deref(), expr)
230230
}
231231
ExprKind::Continue(destination) => {
232232
if destination.target_id.is_ok() {
@@ -237,7 +237,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
237237
}
238238
}
239239
ExprKind::Ret(ref expr_opt) => {
240-
self.check_expr_return(expr_opt.deref(), expr)
240+
self.check_expr_return(expr_opt.as_deref(), expr)
241241
}
242242
ExprKind::Assign(ref lhs, ref rhs) => {
243243
self.check_expr_assign(expr, expected, lhs, rhs)

Diff for: src/librustdoc/html/render.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2137,7 +2137,7 @@ impl Context {
21372137
self.shared.fs.write(&final_file, &v)?;
21382138

21392139
// Generating settings page.
2140-
let settings = Settings::new(self.shared.static_root_path.deref().unwrap_or("./"),
2140+
let settings = Settings::new(self.shared.static_root_path.as_deref().unwrap_or("./"),
21412141
&self.shared.resource_suffix);
21422142
page.title = "Rustdoc settings";
21432143
page.description = "Settings of Rustdoc";

Diff for: src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref` found for type `std::option::Option<{in
22
--> $DIR/option-as_deref.rs:4:29
33
|
44
LL | let _result = &Some(42).as_deref();
5-
| ^^^^^^^^ help: did you mean: `as_ref`
5+
| ^^^^^^^^ help: there is a method with a similar name: `as_ref`
66
|
77
= note: the method `as_deref` exists but the following trait bounds were not satisfied:
88
`{integer} : std::ops::Deref`

Diff for: src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref` found for type `std::result::Result<{in
22
--> $DIR/result-as_deref.rs:4:27
33
|
44
LL | let _result = &Ok(42).as_deref();
5-
| ^^^^^^^^ help: did you mean: `as_ref`
5+
| ^^^^^^^^ help: there is a method with a similar name: `as_ref`
66
|
77
= note: the method `as_deref` exists but the following trait bounds were not satisfied:
88
`{integer} : std::ops::Deref`

Diff for: src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_err.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_err` found for type `std::result::Result
22
--> $DIR/result-as_deref_err.rs:4:28
33
|
44
LL | let _result = &Err(41).as_deref_err();
5-
| ^^^^^^^^^^^^ help: did you mean: `as_deref_ok`
5+
| ^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_ok`
66
|
77
= note: the method `as_deref_err` exists but the following trait bounds were not satisfied:
88
`{integer} : std::ops::Deref`

Diff for: src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_mut` found for type `std::result::Result
22
--> $DIR/result-as_deref_mut.rs:4:31
33
|
44
LL | let _result = &mut Ok(42).as_deref_mut();
5-
| ^^^^^^^^^^^^ help: did you mean: `as_deref_err`
5+
| ^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_err`
66
|
77
= note: the method `as_deref_mut` exists but the following trait bounds were not satisfied:
88
`{integer} : std::ops::DerefMut`

Diff for: src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_mut_err` found for type `std::result::Re
22
--> $DIR/result-as_deref_mut_err.rs:4:32
33
|
44
LL | let _result = &mut Err(41).as_deref_mut_err();
5-
| ^^^^^^^^^^^^^^^^ help: did you mean: `as_deref_mut_ok`
5+
| ^^^^^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_mut_ok`
66
|
77
= note: the method `as_deref_mut_err` exists but the following trait bounds were not satisfied:
88
`{integer} : std::ops::DerefMut`

Diff for: src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_ok.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_mut_ok` found for type `std::result::Res
22
--> $DIR/result-as_deref_mut_ok.rs:4:31
33
|
44
LL | let _result = &mut Ok(42).as_deref_mut_ok();
5-
| ^^^^^^^^^^^^^^^ help: did you mean: `as_deref_mut_err`
5+
| ^^^^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_mut_err`
66
|
77
= note: the method `as_deref_mut_ok` exists but the following trait bounds were not satisfied:
88
`{integer} : std::ops::DerefMut`

Diff for: src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_ok.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_ok` found for type `std::result::Result<
22
--> $DIR/result-as_deref_ok.rs:4:27
33
|
44
LL | let _result = &Ok(42).as_deref_ok();
5-
| ^^^^^^^^^^^ help: did you mean: `as_deref_err`
5+
| ^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_err`
66
|
77
= note: the method `as_deref_ok` exists but the following trait bounds were not satisfied:
88
`{integer} : std::ops::Deref`

0 commit comments

Comments
 (0)