Skip to content

Commit dff0294

Browse files
authored
fix examples using Ty.kind() in the book (#13875)
`Ty.kind()` is a method. changelog: none
2 parents 85b6094 + b28bfbc commit dff0294

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

book/src/development/common_tools_writing_lints.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl LateLintPass<'_> for MyStructLint {
3737
// Get type of `expr`
3838
let ty = cx.typeck_results().expr_ty(expr);
3939
// Match its kind to enter its type
40-
match ty.kind {
40+
match ty.kind() {
4141
ty::Adt(adt_def, _) if adt_def.is_struct() => println!("Our `expr` is a struct!"),
4242
_ => ()
4343
}

book/src/development/type_checking.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl LateLintPass<'_> for MyStructLint {
9494
// Get type of `expr`
9595
let ty = cx.typeck_results().expr_ty(expr);
9696
// Match its kind to enter the type
97-
match ty.kind {
97+
match ty.kind() {
9898
ty::Adt(adt_def, _) if adt_def.is_struct() => println!("Our `expr` is a struct!"),
9999
_ => ()
100100
}

0 commit comments

Comments
 (0)