mind-body: clippy clean at -D warnings (poll iterates its rows, a identity map and the unused Recording::stop go)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3148dbba43
commit
baefb01c38
3 changed files with 9 additions and 15 deletions
|
|
@ -596,13 +596,12 @@ pub fn poll(organs: &Organs, config: &Config) -> Result<Outcome> {
|
|||
// Off the beat: the operator naming her, once per message, and her Self run
|
||||
// having ended since her last turn. Neither waits for the beat; both need her
|
||||
// idle and released.
|
||||
for index in 0..rows.len() {
|
||||
if !rows[index].idle() {
|
||||
for row in &mut rows {
|
||||
if !row.idle() {
|
||||
continue;
|
||||
}
|
||||
let slug = rows[index].slug().clone();
|
||||
let slug = row.slug().clone();
|
||||
let mentioned = {
|
||||
let row = &rows[index];
|
||||
let mut pending: Vec<&ChatDelivery> = row.pending.iter().collect();
|
||||
pending.sort_by_key(|delivery| delivery.seq);
|
||||
pending
|
||||
|
|
@ -611,7 +610,7 @@ pub fn poll(organs: &Organs, config: &Config) -> Result<Outcome> {
|
|||
.map(|delivery| format!("{}:{}", slug.0, delivery.event_id))
|
||||
.find(|key| !state.handled_mentions.contains(key))
|
||||
};
|
||||
let self_ended = rows[index].read.as_ref().is_some_and(|read| match (read.self_end, read.last_turn) {
|
||||
let self_ended = row.read.as_ref().is_some_and(|read| match (read.self_end, read.last_turn) {
|
||||
(Some(ended), Some(turn)) => ended > turn,
|
||||
(Some(_), None) => true,
|
||||
_ => false,
|
||||
|
|
@ -619,19 +618,19 @@ pub fn poll(organs: &Organs, config: &Config) -> Result<Outcome> {
|
|||
if mentioned.is_none() && !self_ended {
|
||||
continue;
|
||||
}
|
||||
match launch(organs, &rows[index])? {
|
||||
match launch(organs, row)? {
|
||||
Launched::Run(label) => {
|
||||
if let Some(key) = mentioned {
|
||||
state.handled_mentions.push(key);
|
||||
let excess = state.handled_mentions.len().saturating_sub(MENTIONS_KEPT);
|
||||
state.handled_mentions.drain(..excess);
|
||||
}
|
||||
rows[index].busy = true;
|
||||
row.busy = true;
|
||||
launches.push(label);
|
||||
launched.push(slug);
|
||||
}
|
||||
Launched::Busy => rows[index].busy = true,
|
||||
Launched::Refused(why) => rows[index].note = why,
|
||||
Launched::Busy => row.busy = true,
|
||||
Launched::Refused(why) => row.note = why,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -589,7 +589,7 @@ fn an_old_heartbeat_store_fails_closed_naming_the_file_and_is_never_migrated() {
|
|||
cache.pull_all_backing_stores().unwrap();
|
||||
cache.put("eureka", &OldInitiative { initiative: "3.5".into() }).unwrap();
|
||||
let store = FileStore::new(&path);
|
||||
for result in [store.check().map(|()| ()), store.load().map(|_| ()), store.latest().map(|_| ()), store.save(&HeartbeatState { last_beat_at: crate::testkit::at(1), handled_mentions: vec![] }), store.record(&trace_at(1, 900))] {
|
||||
for result in [store.check(), store.load().map(|_| ()), store.latest().map(|_| ()), store.save(&HeartbeatState { last_beat_at: crate::testkit::at(1), handled_mentions: vec![] }), store.record(&trace_at(1, 900))] {
|
||||
let error = format!("{:#}", result.unwrap_err());
|
||||
assert!(error.contains(&path.display().to_string()) && error.contains("archive it, nothing migrates it"), "{error}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,11 +55,6 @@ impl Recording {
|
|||
self.running.borrow_mut().retain(|unit| *unit != (Slug(INSTANCE.into()), turn));
|
||||
}
|
||||
|
||||
/// One named instance's unit ends.
|
||||
pub(crate) fn stop(&self, instance: &Slug, turn: RunTurn) {
|
||||
self.running.borrow_mut().retain(|unit| *unit != (instance.clone(), turn));
|
||||
}
|
||||
|
||||
pub(crate) fn revive(&self, turn: RunTurn) {
|
||||
self.running.borrow_mut().push((Slug(INSTANCE.into()), turn));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue