1
Fork 0

fix examples using Ty.kind() in the book (#13875)

`Ty.kind()` is a method.

changelog: none
This commit is contained in:
Philipp Krones 2024-12-26 12:31:32 +00:00 committed by GitHub
commit dff0294ab3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -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!"),
_ => ()
}

View file

@ -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!"),
_ => ()
}