mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
fix limit condition
This commit is contained in:
parent
9db4049169
commit
64f1867aa3
1 changed files with 3 additions and 3 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue