Add remove_from_all method to Corpus
trait (#2259)
* add remove_from_all * a * a * aaaaaaa * make remove_from_all to remove
This commit is contained in:
parent
b96b9be674
commit
e912216a37
@ -107,9 +107,8 @@ where
|
||||
self.inner.replace(idx, testcase)
|
||||
}
|
||||
|
||||
/// Removes an entry from the corpus, returning it if it was present.
|
||||
#[inline]
|
||||
fn remove(&mut self, idx: CorpusId) -> Result<Testcase<I>, Error> {
|
||||
/// Removes an entry from the corpus, returning it if it was present; considers both enabled and disabled testcases.
|
||||
fn remove(&mut self, idx: CorpusId) -> Result<Testcase<Self::Input>, Error> {
|
||||
let testcase = self.inner.remove(idx)?;
|
||||
self.cached_indexes.borrow_mut().retain(|e| *e != idx);
|
||||
Ok(testcase)
|
||||
|
@ -396,12 +396,14 @@ where
|
||||
.ok_or_else(|| Error::key_not_found(format!("Index {idx} not found")))
|
||||
}
|
||||
|
||||
/// Removes an entry from the corpus, returning it if it was present.
|
||||
/// Removes an entry from the corpus, returning it if it was present; considers both enabled and disabled testcases
|
||||
#[inline]
|
||||
fn remove(&mut self, idx: CorpusId) -> Result<Testcase<I>, Error> {
|
||||
self.storage
|
||||
.enabled
|
||||
.remove(idx)
|
||||
fn remove(&mut self, idx: CorpusId) -> Result<Testcase<Self::Input>, Error> {
|
||||
let mut testcase = self.storage.enabled.remove(idx);
|
||||
if testcase.is_none() {
|
||||
testcase = self.storage.disabled.remove(idx);
|
||||
}
|
||||
testcase
|
||||
.map(|x| x.take())
|
||||
.ok_or_else(|| Error::key_not_found(format!("Index {idx} not found")))
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ where
|
||||
Ok(entry)
|
||||
}
|
||||
|
||||
/// Removes an entry from the corpus, returning it if it was present.
|
||||
/// Removes an entry from the corpus, returning it if it was present; considers both enabled and disabled corpus
|
||||
#[inline]
|
||||
fn remove(&mut self, idx: CorpusId) -> Result<Testcase<I>, Error> {
|
||||
let entry = self.inner.remove(idx)?;
|
||||
|
@ -113,7 +113,7 @@ pub trait Corpus: UsesInput + Serialize + for<'de> Deserialize<'de> {
|
||||
testcase: Testcase<Self::Input>,
|
||||
) -> Result<Testcase<Self::Input>, Error>;
|
||||
|
||||
/// Removes an entry from the corpus, returning it if it was present.
|
||||
/// Removes an entry from the corpus, returning it if it was present; considers both enabled and disabled testcases
|
||||
fn remove(&mut self, id: CorpusId) -> Result<Testcase<Self::Input>, Error>;
|
||||
|
||||
/// Get by id; considers only enabled testcases
|
||||
|
@ -63,7 +63,7 @@ where
|
||||
Err(Error::unsupported("Unsupported by NopCorpus"))
|
||||
}
|
||||
|
||||
/// Removes an entry from the corpus, returning it if it was present.
|
||||
/// Removes an entry from the corpus, returning it if it was present; considers both enabled and disabled testcases
|
||||
#[inline]
|
||||
fn remove(&mut self, _idx: CorpusId) -> Result<Testcase<I>, Error> {
|
||||
Err(Error::unsupported("Unsupported by NopCorpus"))
|
||||
|
@ -112,7 +112,7 @@ where
|
||||
self.inner.peek_free_id()
|
||||
}
|
||||
|
||||
/// Removes an entry from the corpus, returning it if it was present.
|
||||
/// Removes an entry from the corpus, returning it if it was present; considers both enabled and disabled testcases
|
||||
#[inline]
|
||||
fn remove(&mut self, idx: CorpusId) -> Result<Testcase<I>, Error> {
|
||||
self.inner.remove(idx)
|
||||
|
Loading…
x
Reference in New Issue
Block a user