diff options
| author | Philipp Krones <hello@philkrones.com> | 2024-12-26 12:31:32 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-26 12:31:32 +0000 |
| commit | dff0294ab34f943956d53d2362cb8925ca416edd (patch) | |
| tree | cc43c5a437189294c769ad76ceac1cc1532f571f | |
| parent | 85b609419bc765cf8685b22d3f812909d7f622b6 (diff) | |
| parent | b28bfbceeb16610b9c7d8658069252b571dea3a1 (diff) | |
| download | rust-dff0294ab34f943956d53d2362cb8925ca416edd.tar.gz rust-dff0294ab34f943956d53d2362cb8925ca416edd.zip | |
fix examples using `Ty.kind()` in the book (#13875)
`Ty.kind()` is a method. changelog: none
| -rw-r--r-- | book/src/development/common_tools_writing_lints.md | 2 | ||||
| -rw-r--r-- | book/src/development/type_checking.md | 2 |
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!"), _ => () } |
