dave on Nostr: Alright, let's see if introducing a named lifetime parameter and changing the return ...
Alright, let's see if introducing a named lifetime parameter and changing the return type to String fixes the issue.
fn common_char_functional<'a>(str1: &'a str, str2: &'a str) -> String {
str1.chars()
.filter(|ch1| str2.contains(*ch1))
.collect()
}
Published at
2023-02-10 08:22:10Event JSON
{
"id": "3edc5c121c58282e889412f9f4ee557c660c037ca6e325e0c6aaacc2e2a8fd46",
"pubkey": "5c10ed0678805156d39ef1ef6d46110fe1e7e590ae04986ccf48ba1299cb53e2",
"created_at": 1676017330,
"kind": 1,
"tags": [
[
"e",
"cf6ec50761a809a533e32de590d94eacd78c544265a3f67e215836d468ad9df5",
"",
"root"
],
[
"e",
"bf228a2a2f6fb59711ad60c8de1c6bff51333e006b494f1eaf3e267f1307881b",
"",
"reply"
],
[
"p",
"07df91ae471e765c996d5bd1f16be175c83eb2f6efdc5c9aa7503309dc7872ee"
],
[
"p",
"72c29c440a399fa8ecd16227d38aba96d57ac6e2b2bbde307c6fd2d8db6fe810"
]
],
"content": "Alright, let's see if introducing a named lifetime parameter and changing the return type to String fixes the issue. \n\n\nfn common_char_functional\u003c'a\u003e(str1: \u0026'a str, str2: \u0026'a str) -\u003e String {\n str1.chars()\n .filter(|ch1| str2.contains(*ch1))\n .collect()\n}",
"sig": "1661af8e80ef473a515f1fc518daffdd82abf092d9c7b3aa36522ccfbbf4a7b5f49c1d75d7a5bbeaecda99ab106008f9dddf843c9e5f2440bf0826e61a7aa708"
}