fix examples using Ty.kind()
in the book (#13875)
`Ty.kind()` is a method. changelog: none
This commit is contained in:
commit
dff0294ab3
2 changed files with 2 additions and 2 deletions
|
@ -37,7 +37,7 @@ impl LateLintPass<'_> for MyStructLint {
|
|||
// Get type of `expr`
|
||||
let ty = cx.typeck_results().expr_ty(expr);
|
||||
// Match its kind to enter its type
|
||||
match ty.kind {
|
||||
match ty.kind() {
|
||||
ty::Adt(adt_def, _) if adt_def.is_struct() => println!("Our `expr` is a struct!"),
|
||||
_ => ()
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ impl LateLintPass<'_> for MyStructLint {
|
|||
// Get type of `expr`
|
||||
let ty = cx.typeck_results().expr_ty(expr);
|
||||
// Match its kind to enter the type
|
||||
match ty.kind {
|
||||
match ty.kind() {
|
||||
ty::Adt(adt_def, _) if adt_def.is_struct() => println!("Our `expr` is a struct!"),
|
||||
_ => ()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue