Skip to content

Commit

Permalink
Replace deref with as_deref
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Jul 18, 2019
1 parent f2a9721 commit 59634bc
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/librustc/hir/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ impl<'a> State<'a> {
self.maybe_print_comment(st.span.lo());
match st.node {
hir::StmtKind::Local(ref loc) => {
self.print_local(loc.init.deref(), |this| this.print_local_decl(&loc));
self.print_local(loc.init.as_deref(), |this| this.print_local_decl(&loc));
}
hir::StmtKind::Item(item) => {
self.ann.nested(self, Nested::Item(item))
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/check/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
tcx.mk_unit()
}
ExprKind::Break(destination, ref expr_opt) => {
self.check_expr_break(destination, expr_opt.deref(), expr)
self.check_expr_break(destination, expr_opt.as_deref(), expr)
}
ExprKind::Continue(destination) => {
if destination.target_id.is_ok() {
Expand All @@ -237,7 +237,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
}
ExprKind::Ret(ref expr_opt) => {
self.check_expr_return(expr_opt.deref(), expr)
self.check_expr_return(expr_opt.as_deref(), expr)
}
ExprKind::Assign(ref lhs, ref rhs) => {
self.check_expr_assign(expr, expected, lhs, rhs)
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2137,7 +2137,7 @@ impl Context {
self.shared.fs.write(&final_file, &v)?;

// Generating settings page.
let settings = Settings::new(self.shared.static_root_path.deref().unwrap_or("./"),
let settings = Settings::new(self.shared.static_root_path.as_deref().unwrap_or("./"),
&self.shared.resource_suffix);
page.title = "Rustdoc settings";
page.description = "Settings of Rustdoc";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref` found for type `std::option::Option<{in
--> $DIR/option-as_deref.rs:4:29
|
LL | let _result = &Some(42).as_deref();
| ^^^^^^^^ help: did you mean: `as_ref`
| ^^^^^^^^ help: there is a method with a similar name: `as_ref`
|
= note: the method `as_deref` exists but the following trait bounds were not satisfied:
`{integer} : std::ops::Deref`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref` found for type `std::result::Result<{in
--> $DIR/result-as_deref.rs:4:27
|
LL | let _result = &Ok(42).as_deref();
| ^^^^^^^^ help: did you mean: `as_ref`
| ^^^^^^^^ help: there is a method with a similar name: `as_ref`
|
= note: the method `as_deref` exists but the following trait bounds were not satisfied:
`{integer} : std::ops::Deref`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_err` found for type `std::result::Result
--> $DIR/result-as_deref_err.rs:4:28
|
LL | let _result = &Err(41).as_deref_err();
| ^^^^^^^^^^^^ help: did you mean: `as_deref_ok`
| ^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_ok`
|
= note: the method `as_deref_err` exists but the following trait bounds were not satisfied:
`{integer} : std::ops::Deref`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_mut` found for type `std::result::Result
--> $DIR/result-as_deref_mut.rs:4:31
|
LL | let _result = &mut Ok(42).as_deref_mut();
| ^^^^^^^^^^^^ help: did you mean: `as_deref_err`
| ^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_err`
|
= note: the method `as_deref_mut` exists but the following trait bounds were not satisfied:
`{integer} : std::ops::DerefMut`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_mut_err` found for type `std::result::Re
--> $DIR/result-as_deref_mut_err.rs:4:32
|
LL | let _result = &mut Err(41).as_deref_mut_err();
| ^^^^^^^^^^^^^^^^ help: did you mean: `as_deref_mut_ok`
| ^^^^^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_mut_ok`
|
= note: the method `as_deref_mut_err` exists but the following trait bounds were not satisfied:
`{integer} : std::ops::DerefMut`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_mut_ok` found for type `std::result::Res
--> $DIR/result-as_deref_mut_ok.rs:4:31
|
LL | let _result = &mut Ok(42).as_deref_mut_ok();
| ^^^^^^^^^^^^^^^ help: did you mean: `as_deref_mut_err`
| ^^^^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_mut_err`
|
= note: the method `as_deref_mut_ok` exists but the following trait bounds were not satisfied:
`{integer} : std::ops::DerefMut`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0599]: no method named `as_deref_ok` found for type `std::result::Result<
--> $DIR/result-as_deref_ok.rs:4:27
|
LL | let _result = &Ok(42).as_deref_ok();
| ^^^^^^^^^^^ help: did you mean: `as_deref_err`
| ^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_err`
|
= note: the method `as_deref_ok` exists but the following trait bounds were not satisfied:
`{integer} : std::ops::Deref`
Expand Down

0 comments on commit 59634bc

Please sign in to comment.