style: rustfmt and one clippy lint over the P5 files
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp
This commit is contained in:
1 parent
7bac25496e
commit
632938fa97
11 files changed
+302
-108
No files matched your search
@@ -1552,11 +1552,9 @@ impl BooksServer {
|
||||
if let Some(id) = p.revises {
|
||||
// A source correction: the decision's words stay (the ones
|
||||
// given, if any, must be the ones it has).
|
||||
let old = store
|
||||
.ledger()
|
||||
.conventions()
|
||||
.decision(id)
|
||||
.ok_or_else(|| format!("decision {id} doesn't exist: books.decisions lists them"))?;
|
||||
let old = store.ledger().conventions().decision(id).ok_or_else(|| {
|
||||
format!("decision {id} doesn't exist: books.decisions lists them")
|
||||
})?;
|
||||
if (!p.subject.is_empty() && p.subject != old.new.subject)
|
||||
|| (!p.decision_md.is_empty() && p.decision_md != old.new.decision_md)
|
||||
{
|
||||
|
||||
@@ -149,8 +149,11 @@ impl BooksServer {
|
||||
.with_required(true)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let mut prompt =
|
||||
Prompt::new(p.name, Some(p.description), (!args.is_empty()).then_some(args));
|
||||
let mut prompt = Prompt::new(
|
||||
p.name,
|
||||
Some(p.description),
|
||||
(!args.is_empty()).then_some(args),
|
||||
);
|
||||
prompt.title = Some(p.title.to_string());
|
||||
prompt
|
||||
})
|
||||
@@ -171,7 +174,11 @@ impl BooksServer {
|
||||
format!(
|
||||
"there is no prompt {:?}: {}",
|
||||
request.name.chars().take(40).collect::<String>(),
|
||||
PROMPTS.iter().map(|p| p.name).collect::<Vec<_>>().join(", ")
|
||||
PROMPTS
|
||||
.iter()
|
||||
.map(|p| p.name)
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")
|
||||
)
|
||||
})?;
|
||||
let mut text = def.text.trim_end().to_string();
|
||||
@@ -214,7 +221,10 @@ mod tests {
|
||||
.collect();
|
||||
for p in &PROMPTS {
|
||||
let mut seen = 0;
|
||||
for word in p.text.split(|c: char| !(c.is_ascii_alphanumeric() || c == '_' || c == '.')) {
|
||||
for word in p
|
||||
.text
|
||||
.split(|c: char| !(c.is_ascii_alphanumeric() || c == '_' || c == '.'))
|
||||
{
|
||||
if let Some(tool) = word.strip_prefix("books.") {
|
||||
let tool = tool.trim_end_matches('.');
|
||||
if !tool.is_empty() {
|
||||
@@ -229,7 +239,11 @@ mod tests {
|
||||
}
|
||||
assert!(seen > 0, "{} names no tool", p.name);
|
||||
for (name, _, _) in p.args {
|
||||
assert!(p.text.contains(&format!("{{{{{name}}}}}")), "{}: {name}", p.name);
|
||||
assert!(
|
||||
p.text.contains(&format!("{{{{{name}}}}}")),
|
||||
"{}: {name}",
|
||||
p.name
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user