about summary refs log tree commit diff
diff options
context:
space:
mode:
authorlapla-cogito <me@lapla.dev>2024-12-25 13:59:48 +0900
committerlapla-cogito <me@lapla.dev>2024-12-25 13:59:48 +0900
commitb28bfbceeb16610b9c7d8658069252b571dea3a1 (patch)
treecc43c5a437189294c769ad76ceac1cc1532f571f
parent85b609419bc765cf8685b22d3f812909d7f622b6 (diff)
downloadrust-b28bfbceeb16610b9c7d8658069252b571dea3a1.tar.gz
rust-b28bfbceeb16610b9c7d8658069252b571dea3a1.zip
fix examples using Ty.kind()
-rw-r--r--book/src/development/common_tools_writing_lints.md2
-rw-r--r--book/src/development/type_checking.md2
2 files changed, 2 insertions, 2 deletions
diff --git a/book/src/development/common_tools_writing_lints.md b/book/src/development/common_tools_writing_lints.md
index 77910917963..c354e8914f5 100644
--- a/book/src/development/common_tools_writing_lints.md
+++ b/book/src/development/common_tools_writing_lints.md
@@ -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!"),
             _ => ()
         }
diff --git a/book/src/development/type_checking.md b/book/src/development/type_checking.md
index e6da4322a17..578836ecc56 100644
--- a/book/src/development/type_checking.md
+++ b/book/src/development/type_checking.md
@@ -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!"),
             _ => ()
         }