fix limit condition

This commit is contained in:
yggverse 2025-03-13 14:17:06 +02:00
parent 9db4049169
commit 64f1867aa3

View File

@ -57,7 +57,7 @@ impl Memory {
}) })
.enumerate() .enumerate()
{ {
if limit.is_some_and(|l| i > l) { if limit.is_some_and(|l| i >= l) {
break; break;
} }
recent.push(item.clone()) recent.push(item.clone())
@ -74,7 +74,7 @@ impl Memory {
.sorted_by(|a, b| Ord::cmp(&b.opened.time, &a.opened.time)) .sorted_by(|a, b| Ord::cmp(&b.opened.time, &a.opened.time))
.enumerate() .enumerate()
{ {
if limit.is_some_and(|l| i > l) { if limit.is_some_and(|l| i >= l) {
break; break;
} }
recent.push(item.clone()) recent.push(item.clone())
@ -87,7 +87,7 @@ impl Memory {
pub fn contains_request(&self, request: &str, limit: Option<usize>) -> Vec<Item> { pub fn contains_request(&self, request: &str, limit: Option<usize>) -> Vec<Item> {
let mut items: Vec<Item> = Vec::new(); let mut items: Vec<Item> = Vec::new();
for (i, item) in self.0.iter().enumerate() { for (i, item) in self.0.iter().enumerate() {
if limit.is_some_and(|l| i > l) { if limit.is_some_and(|l| i >= l) {
break; break;
} }
let p = request.to_lowercase(); let p = request.to_lowercase();