From e274f874592b7196fb30683943c348c41329d2ff Mon Sep 17 00:00:00 2001 From: Anand Rajagopal Date: Sat, 7 Feb 2026 20:49:48 -0600 Subject: [PATCH] Change filter closure to use move semantics Without the move, the function search will not compile --- listings/ch13-functional-features/listing-13-22/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/listings/ch13-functional-features/listing-13-22/src/lib.rs b/listings/ch13-functional-features/listing-13-22/src/lib.rs index 28af29e727..4e6e4238bb 100644 --- a/listings/ch13-functional-features/listing-13-22/src/lib.rs +++ b/listings/ch13-functional-features/listing-13-22/src/lib.rs @@ -2,7 +2,7 @@ pub fn search<'a>(query: &str, contents: &'a str) -> Vec<&'a str> { contents .lines() - .filter(|line| line.contains(query)) + .filter(move |line| line.contains(query)) .collect() } // ANCHOR_END: here