mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-08-31 00:42:01 +00:00
fix limit condition
This commit is contained in:
parent
9db4049169
commit
64f1867aa3
@ -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();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user