From 5245c58cd31ab75d834576d341a0bb2218050ade Mon Sep 17 00:00:00 2001 From: Jian Weihang Date: Sun, 24 Feb 2019 22:54:07 +0800 Subject: [PATCH] Replace `T: 'a + Messenger` with `T: Messenger` reasons: 1. This annotation is no longer needed since it can be inferred from the fields present in the definitions in Rust 2018. 2. `T: 'a` annotation is never mentioned in previous chapters, this would make beinners confused. references: https://github.com/rust-lang/rfcs/pull/2093 https://github.com/rust-lang/rust/issues/44493 https://rust-lang-nursery.github.io/edition-guide/rust-2018/ownership-and-lifetimes/inference-in-structs.html --- src/ch15-05-interior-mutability.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ch15-05-interior-mutability.md b/src/ch15-05-interior-mutability.md index 5210ff3b83..c730d02bf3 100644 --- a/src/ch15-05-interior-mutability.md +++ b/src/ch15-05-interior-mutability.md @@ -140,7 +140,7 @@ pub trait Messenger { fn send(&self, msg: &str); } -pub struct LimitTracker<'a, T: 'a + Messenger> { +pub struct LimitTracker<'a, T: Messenger> { messenger: &'a T, value: usize, max: usize,