The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.
Rust ffmpegfree-video-editormodel-context-protocolnon-linear-editoroffline-firstopen-source-video-editorself-hostedvideo-editingvideo-editing-automationvideo-editing-softwarevideo-editing-toolsvideo-editorvoice-cloningyoutube-automationyoutube-shorts
style: rustfmt over the API, MCP, server and library code
Jareerdd91ca8a00aa
diff --git a/src/crates/concat-api/src/job.rs b/src/crates/concat-api/src/job.rsindex 49116a13..314b2c76 100644--- a/src/crates/concat-api/src/job.rs+++ b/src/crates/concat-api/src/job.rs@@ -204,10 +204,7 @@ mod tests {path: "/p".to_owned(),error: ApiError::new(ErrorCode::Cancelled, "The export was cancelled"),});- assert_eq!(- book.status("j1").expect("known").state,- JobState::Cancelled- );+ assert_eq!(book.status("j1").expect("known").state, JobState::Cancelled);}#[test]diff --git a/src/crates/concat-api/src/lib.rs b/src/crates/concat-api/src/lib.rsindex d623b3f7..3b41fec7 100644--- a/src/crates/concat-api/src/lib.rs+++ b/src/crates/concat-api/src/lib.rs@@ -187,7 +187,13 @@ impl OpenProjects {// one, which nobody can save over anyway.Err(lock::LockError::Io(_)) => None,};- open.insert(key, Claim { holder, _lock: lock });+ open.insert(+ key,+ Claim {+ holder,+ _lock: lock,+ },+ );Ok(())}}@@ -1593,7 +1599,10 @@ mod tests {};assert_eq!(status.state, JobState::Failed);assert_eq!(status.path, path);- assert_eq!(status.error.map(|error| error.code), Some(ErrorCode::Failed));+ assert_eq!(+ status.error.map(|error| error.code),+ Some(ErrorCode::Failed)+ );let unknown = err(api.dispatch(Request::ExportStatus {job: "j9".to_owned(),}));@@ -1750,12 +1759,24 @@ mod tests {let window = lock::ProjectLock::acquire(Path::new(&path), "window").expect("the window");let refused = err(api.dispatch(Request::ProjectOpen { path: path.clone() }));assert_eq!(refused.code, ErrorCode::Refused);- assert!(refused.message.contains("a Concat window (process"), "{}", refused.message);- assert!(refused.message.contains("concat --mcp window"), "{}", refused.message);+ assert!(+ refused.message.contains("a Concat window (process"),+ "{}",+ refused.message+ );+ assert!(+ refused.message.contains("concat --mcp window"),+ "{}",+ refused.message+ );drop(window);ok(api.dispatch(Request::ProjectOpen { path: path.clone() }));let refused = err(other.dispatch(Request::ProjectOpen { path: path.clone() }));- assert!(refused.message.contains("another Concat process"), "{}", refused.message);+ assert!(+ refused.message.contains("another Concat process"),+ "{}",+ refused.message+ );}}diff --git a/src/crates/concat-host/src/sounds.rs b/src/crates/concat-host/src/sounds.rsindex 98bbfb4d..ffedecee 100644--- a/src/crates/concat-host/src/sounds.rs+++ b/src/crates/concat-host/src/sounds.rs@@ -30,7 +30,9 @@ pub const BARS: usize = 64;/// The extensions the library takes: sound files, the way the bin's/// import names them. A video's soundtrack is not a library sound.-pub const EXTENSIONS: [&str; 9] = ["mp3", "wav", "aac", "m4a", "flac", "ogg", "opus", "aif", "aiff"];+pub const EXTENSIONS: [&str; 9] = [+ "mp3", "wav", "aac", "m4a", "flac", "ogg", "opus", "aif", "aiff",+];/// One sound in the library.#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]@@ -428,19 +430,11 @@ pub fn fetch_sound(let partial = target.with_extension("partial");let mut last = String::new();for url in crate::models::sound_sources(&sound.file) {- match crate::models::download(- &url,- &partial,- sound.bytes,- cancel,- "cancelled",- progress,- ) {+ match crate::models::download(&url, &partial, sound.bytes, cancel, "cancelled", progress) {Ok(_) => match crate::models::verify(&partial, &sound.sha256) {Ok(()) => {- std::fs::rename(&partial, &target).map_err(|error| {- format!("could not keep {}: {error}", target.display())- })?;+ std::fs::rename(&partial, &target)+ .map_err(|error| format!("could not keep {}: {error}", target.display()))?;return Ok(target);}Err(error) => {@@ -508,7 +502,11 @@ mod tests {}let reopened = Library::at(dir.clone());assert_eq!(- reopened.sounds.iter().map(|s| s.id.as_str()).collect::<Vec<_>>(),+ reopened+ .sounds+ .iter()+ .map(|s| s.id.as_str())+ .collect::<Vec<_>>(),["b", "a"]);assert_eq!(reopened.get("a").unwrap().bars.len(), BARS);@@ -516,7 +514,10 @@ mod tests {library.remove("b").unwrap();assert!(!dir.join("Two.wav").exists());std::fs::remove_file(dir.join("One.wav")).unwrap();- assert!(Library::at(dir.clone()).sounds.is_empty(), "a missing copy is left out");+ assert!(+ Library::at(dir.clone()).sounds.is_empty(),+ "a missing copy is left out"+ );let _ = std::fs::remove_dir_all(&dir);}diff --git a/src/crates/concat-host/src/voices.rs b/src/crates/concat-host/src/voices.rsindex c6a44563..7a762515 100644--- a/src/crates/concat-host/src/voices.rs+++ b/src/crates/concat-host/src/voices.rs@@ -124,7 +124,12 @@ pub fn save(};let samples = concat_media::AudioDecoder::open(source, &options).and_then(|mut decoder| decoder.collect_f32())- .map_err(|error| format!("could not read the voice from {}: {error}", source.display()))?;+ .map_err(|error| {+ format!(+ "could not read the voice from {}: {error}",+ source.display()+ )+ })?;// A second is the least a voice can be told from.if samples.len() < SAMPLE_RATE as usize {return Err(format!(@@ -195,7 +200,10 @@ fn copy_picture(path: &Path, folder: &Path) -> Result<String, String> {.map_err(|error| format!("could not read {}: {error}", path.display()))?.len();if size > PICTURE_CAP {- return Err(format!("{} is too large for a voice's picture", path.display()));+ return Err(format!(+ "{} is too large for a voice's picture",+ path.display()+ ));}let file = format!("picture.{extension}");std::fs::copy(path, folder.join(&file))@@ -252,8 +260,14 @@ mod tests {let picture = dir.join("face.PNG");std::fs::write(&picture, b"png").unwrap();- let voice = save(&dir.join("voices"), " Narrator ", &source, 0.5, Some(&picture))- .expect("saves");+ let voice = save(+ &dir.join("voices"),+ " Narrator ",+ &source,+ 0.5,+ Some(&picture),+ )+ .expect("saves");assert_eq!(voice.name, "Narrator");assert!(voice.sample().is_file());assert_eq!(voice.picture.as_deref(), Some("picture.png"));@@ -262,7 +276,10 @@ mod tests {assert_eq!(listed[0].id, voice.id);assert!(listed[0].picture_path().unwrap().is_file());- assert!(save(&dir.join("voices"), " ", &source, 0.0, None).is_err(), "a name is needed");+ assert!(+ save(&dir.join("voices"), " ", &source, 0.0, None).is_err(),+ "a name is needed"+ );assert!(save(&dir.join("voices"), "Late", &source, 2.5, None).is_err(),"half a second is too little"diff --git a/src/crates/concat-mcp/src/backend.rs b/src/crates/concat-mcp/src/backend.rsindex 30eac5ae..266c1293 100644--- a/src/crates/concat-mcp/src/backend.rs+++ b/src/crates/concat-mcp/src/backend.rs@@ -91,12 +91,16 @@ pub fn open(mode: Mode) -> Result<Box<dyn Backend>, String> {/// Where the window's server is, and its token: the environment's if it/// names them, the window's listing otherwise.fn locate() -> Result<(SocketAddr, String), String> {- let address = std::env::var("CONCAT_API_ADDRESS").ok().filter(|text| !text.is_empty());- let token = std::env::var("CONCAT_API_TOKEN").ok().filter(|text| !text.is_empty());+ let address = std::env::var("CONCAT_API_ADDRESS")+ .ok()+ .filter(|text| !text.is_empty());+ let token = std::env::var("CONCAT_API_TOKEN")+ .ok()+ .filter(|text| !text.is_empty());if let (Some(address), Some(token)) = (&address, &token) {- let address = address- .parse()- .map_err(|_| format!("CONCAT_API_ADDRESS {address:?} is not an address like 127.0.0.1:7420"))?;+ let address = address.parse().map_err(|_| {+ format!("CONCAT_API_ADDRESS {address:?} is not an address like 127.0.0.1:7420")+ })?;return Ok((address, token.clone()));}if address.is_some() != token.is_some() {@@ -123,9 +127,8 @@ impl Window {/// Connects to the window's server.pub fn find() -> Result<Window, String> {let (address, token) = locate()?;- let client = Client::connect(address, &token, PATIENCE).map_err(|error| {- format!("{error} (if the window has closed, its listing is stale)")- })?;+ let client = Client::connect(address, &token, PATIENCE)+ .map_err(|error| format!("{error} (if the window has closed, its listing is stale)"))?;Ok(Window { client })}@@ -140,7 +143,11 @@ impl Window {impl Backend for Window {fn call(&mut self, request: Request) -> Result<Value, ApiError> {match self.client.call(&request) {- Err(error) if error.message.starts_with("the connection to the Concat server") => {+ Err(error)+ if error+ .message+ .starts_with("the connection to the Concat server") =>+ {let again = Window::find().map_err(|why| {ApiError::failed(format!("{} - and reconnecting failed: {why}",diff --git a/src/crates/concat-mcp/src/protocol.rs b/src/crates/concat-mcp/src/protocol.rsindex 97c783c5..f1c0a632 100644--- a/src/crates/concat-mcp/src/protocol.rs+++ b/src/crates/concat-mcp/src/protocol.rs@@ -163,7 +163,12 @@ fn read(let message = match serde_json::from_str::<Value>(&line) {Ok(message) => message,Err(error) => {- output.send(&failure(Value::Null, code::PARSE, &format!("not JSON: {error}"), None));+ output.send(&failure(+ Value::Null,+ code::PARSE,+ &format!("not JSON: {error}"),+ None,+ ));continue;}};@@ -178,7 +183,10 @@ fn read());continue;};- let method = message.get("method").and_then(Value::as_str).map(str::to_owned);+ let method = message+ .get("method")+ .and_then(Value::as_str)+ .map(str::to_owned);let id = message.remove("id");let params = message.remove("params").unwrap_or(Value::Null);match (method, id) {@@ -374,7 +382,12 @@ impl Server {cancelled: &AtomicBool,) -> Value {let Some(name) = params.get("name").and_then(Value::as_str) else {- return failure(id.clone(), code::INVALID_PARAMS, "tools/call names a tool", None);+ return failure(+ id.clone(),+ code::INVALID_PARAMS,+ "tools/call names a tool",+ None,+ );};let arguments = params.get("arguments").cloned().unwrap_or(Value::Null);if !(arguments.is_object() || arguments.is_null()) {diff --git a/src/crates/concat-mcp/src/schema.rs b/src/crates/concat-mcp/src/schema.rsindex 29d9d7d8..f8ba21b3 100644--- a/src/crates/concat-mcp/src/schema.rs+++ b/src/crates/concat-mcp/src/schema.rs@@ -115,7 +115,11 @@ impl Schemas {continue;};let body = compact(def.clone());- pending.extend(references(&body).into_iter().filter(|other| !defs.contains_key(other)));+ pending.extend(+ references(&body)+ .into_iter()+ .filter(|other| !defs.contains_key(other)),+ );defs.insert(name, body);}schema["$defs"] = Value::Object(defs);@@ -153,9 +157,13 @@ fn compact(schema: Value) -> Value {Value::Object(object) => Value::Object(object.into_iter()- .filter(|(key, value)| !(key == "default" && (value.is_object() || value.is_array())))+ .filter(|(key, value)| {+ !(key == "default" && (value.is_object() || value.is_array()))+ }).map(|(key, value)| match (key.as_str(), value) {- ("description", Value::String(text)) => (key, Value::String(first_sentence(&text))),+ ("description", Value::String(text)) => {+ (key, Value::String(first_sentence(&text)))+ }(_, value) => (key, compact(value)),}).collect(),@@ -186,16 +194,13 @@ fn alternatives(schema: &Value) -> Vec<Value> {/// The constant an alternative's tag property holds.fn tag_of<'a>(variant: &'a Value, tag: &str) -> Option<&'a str> {let property = variant.pointer(&format!("/properties/{tag}"))?;- property- .get("const")- .and_then(Value::as_str)- .or_else(|| {- property- .get("enum")- .and_then(Value::as_array)- .and_then(|values| values.first())- .and_then(Value::as_str)- })+ property.get("const").and_then(Value::as_str).or_else(|| {+ property+ .get("enum")+ .and_then(Value::as_array)+ .and_then(|values| values.first())+ .and_then(Value::as_str)+ })}/// An alternative without its tag: the property and its requirement.@@ -206,7 +211,9 @@ fn without(mut variant: Value, tag: &str) -> Value {if let Some(required) = variant.get_mut("required").and_then(Value::as_array_mut) {required.retain(|name| name.as_str() != Some(tag));if required.is_empty() {- variant.as_object_mut().map(|object| object.remove("required"));+ variant+ .as_object_mut()+ .map(|object| object.remove("required"));}}if variant.get("properties").is_none() {@@ -220,7 +227,10 @@ fn add_required(schema: &mut Value, name: &str, property: Value) {schema["properties"][name] = property;let mut names = vec![json!(name)];if let Some(Value::Array(rest)) = schema.get_mut("required").map(Value::take) {- names.extend(rest.into_iter().filter(|other| other.as_str() != Some(name)));+ names.extend(+ rest.into_iter()+ .filter(|other| other.as_str() != Some(name)),+ );}schema["required"] = Value::Array(names);}@@ -248,7 +258,10 @@ fn inline(&& let Some(name) = reference.strip_prefix("#/$defs/"){let name = name.to_owned();- if SHARED.contains(&name.as_str()) || stack.contains(&name) || !defs.contains_key(&name) {+ if SHARED.contains(&name.as_str())+ || stack.contains(&name)+ || !defs.contains_key(&name)+ {kept.insert(name);return Value::Object(object);}@@ -389,7 +402,11 @@ pub(crate) fn check(schema: &Value, value: &Value, root: &Value, at: &str) -> Re.iter().filter(|choice| check(choice, value, root, at).is_ok()).count();- let ok = if key == "oneOf" { fitting == 1 } else { fitting >= 1 };+ let ok = if key == "oneOf" {+ fitting == 1+ } else {+ fitting >= 1+ };if !ok {let why: Vec<String> = choices.iter()@@ -417,7 +434,9 @@ mod tests {assert!(schemas.method("project.nope").is_none());let set_video = schemas.method("project.setVideo").expect("a method");assert!(- set_video.pointer("/properties/video/properties/width").is_some(),+ set_video+ .pointer("/properties/video/properties/width")+ .is_some(),"VideoSettings inlined: {set_video}");assert!(!set_video.to_string().contains("$ref"));@@ -427,7 +446,10 @@ mod tests {fn a_command_carries_the_project_path() {let schemas = Schemas::generate();let trim = schemas.command("trimClip").expect("a command");- assert_eq!(trim.pointer("/properties/path/type"), Some(&json!("string")));+ assert_eq!(+ trim.pointer("/properties/path/type"),+ Some(&json!("string"))+ );assert!(trim["properties"].get("op").is_none());let required = trim["required"].as_array().expect("required");assert!(required.contains(&json!("path")) && required.contains(&json!("clipId")));@@ -462,7 +484,12 @@ mod tests {Some(&json!("#/$defs/Command")));let command = batch.pointer("/$defs/Command").expect("carried");- assert!(command.get("oneOf").or_else(|| command.get("anyOf")).is_some());+ assert!(+ command+ .get("oneOf")+ .or_else(|| command.get("anyOf"))+ .is_some()+ );let sample = json!({"path": "/p","commands": [diff --git a/src/crates/concat-mcp/src/summary.rs b/src/crates/concat-mcp/src/summary.rsindex c76aa9ec..2ae3910c 100644--- a/src/crates/concat-mcp/src/summary.rs+++ b/src/crates/concat-mcp/src/summary.rs@@ -37,7 +37,9 @@ pub fn view(view: &Value) -> Value {});let length = clips.iter()- .map(|clip| clip["start"].as_f64().unwrap_or(0.0) + clip["duration"].as_f64().unwrap_or(0.0))+ .map(|clip| {+ clip["start"].as_f64().unwrap_or(0.0) + clip["duration"].as_f64().unwrap_or(0.0)+ }).fold(0.0_f64, f64::max);let rate_num = settings["rateNum"].as_f64().unwrap_or(0.0);@@ -106,7 +108,10 @@ fn clip_of(clip: &Value) -> Value {}if let Some(media) = clip["mediaId"].as_str().filter(|media| !media.is_empty()) {out.insert("media".into(), json!(media));- out.insert("sourceStart".into(), json!(round(clip["sourceStart"].as_f64().unwrap_or(0.0), 4)));+ out.insert(+ "sourceStart".into(),+ json!(round(clip["sourceStart"].as_f64().unwrap_or(0.0), 4)),+ );}if let Some(text) = clip.pointer("/text/content") {out.insert("text".into(), text.clone());@@ -236,7 +241,10 @@ mod tests {assert_eq!(clips[1]["opacity"], 0.5);assert!(clips[1].get("media").is_none());let tracks = summary["timeline"]["tracks"].as_array().expect("tracks");- assert_eq!(tracks[1], json!({ "id": "t2", "index": 1, "hidden": true, "muted": true }));+ assert_eq!(+ tracks[1],+ json!({ "id": "t2", "index": 1, "hidden": true, "muted": true })+ );assert_eq!(summary["media"][0]["hasAudio"], true);}}diff --git a/src/crates/concat-mcp/src/tools.rs b/src/crates/concat-mcp/src/tools.rsindex 97f68d6f..ac729c3c 100644--- a/src/crates/concat-mcp/src/tools.rs+++ b/src/crates/concat-mcp/src/tools.rs@@ -481,7 +481,9 @@ impl Outcome {.and_then(|code| code.as_str().map(str::to_owned)).unwrap_or_default();Outcome {- content: vec![json!({ "type": "text", "text": format!("{} (code: {code})", error.message) })],+ content: vec![+ json!({ "type": "text", "text": format!("{} (code: {code})", error.message) }),+ ],structured: Some(json!({ "error": { "code": code, "message": error.message } })),is_error: true,}@@ -609,7 +611,10 @@ fn input_schema(schemas: &Schemas, tool: &Tool) -> Option<Value> {}))}Action::Captions => {- let path = schemas.method("project.get")?.pointer("/properties/path")?.clone();+ let path = schemas+ .method("project.get")?+ .pointer("/properties/path")?+ .clone();let mut style = schemas.def("TextStyle")?;style["description"] = json!("The look every caption shares, as a title's style; only the fields that differ from the default are needed. Its content is replaced by each caption's text."@@ -712,9 +717,15 @@ fn mask(mut arguments: Value) -> Result<Request, ApiError> {let fields = arguments.as_object_mut().ok_or_else(|| invalid("the arguments are an object"))?;- let path = fields.remove("path").ok_or_else(|| invalid("missing field `path`"))?;- let clip = fields.remove("clipId").ok_or_else(|| invalid("missing field `clipId`"))?;- let mask = fields.remove("mask").ok_or_else(|| invalid("missing field `mask`"))?;+ let path = fields+ .remove("path")+ .ok_or_else(|| invalid("missing field `path`"))?;+ let clip = fields+ .remove("clipId")+ .ok_or_else(|| invalid("missing field `clipId`"))?;+ let mask = fields+ .remove("mask")+ .ok_or_else(|| invalid("missing field `mask`"))?;if let Some(unknown) = fields.keys().next() {return Err(invalid(&format!("unknown field `{unknown}`")));}@@ -730,14 +741,18 @@ fn captions(mut arguments: Value) -> Result<Request, ApiError> {let fields = arguments.as_object_mut().ok_or_else(|| invalid("the arguments are an object"))?;- let path = fields.remove("path").ok_or_else(|| invalid("missing field `path`"))?;+ let path = fields+ .remove("path")+ .ok_or_else(|| invalid("missing field `path`"))?;let captions = match fields.remove("captions") {Some(Value::Array(captions)) if !captions.is_empty() => captions,_ => return Err(invalid("`captions` is a list of {start, end, text}")),};let offset = match fields.remove("offsetY") {None | Some(Value::Null) => 0.35,- Some(value) => value.as_f64().ok_or_else(|| invalid("`offsetY` is a number"))?,+ Some(value) => value+ .as_f64()+ .ok_or_else(|| invalid("`offsetY` is a number"))?,};let style = match fields.remove("style") {None | Some(Value::Null) => json!({@@ -794,12 +809,17 @@ fn export_wait(cancelled: &AtomicBool,progress: Option<&dyn Fn(f64, f64, String)>,) -> Result<Outcome, ApiError> {- let timeout = match arguments.as_object_mut().and_then(|fields| fields.remove("timeoutSeconds")) {+ let timeout = match arguments+ .as_object_mut()+ .and_then(|fields| fields.remove("timeoutSeconds"))+ {None | Some(Value::Null) => WAIT_DEFAULT,Some(value) => value.as_f64().filter(|seconds| seconds.is_finite() && *seconds >= 0.0)- .ok_or_else(|| ApiError::invalid("invalid arguments: `timeoutSeconds` is a number of seconds"))?+ .ok_or_else(|| {+ ApiError::invalid("invalid arguments: `timeoutSeconds` is a number of seconds")+ })?.min(WAIT_LONGEST),};let status = request("export.status", arguments)?;@@ -837,7 +857,10 @@ fn export_wait(return Ok(Outcome::json(current));}if cancelled.load(Ordering::Relaxed) {- return Err(ApiError::new(ErrorCode::Cancelled, "stopped waiting; the export goes on"));+ return Err(ApiError::new(+ ErrorCode::Cancelled,+ "stopped waiting; the export goes on",+ ));}if Instant::now() >= until {current["note"] = json!("still running: call export_wait again, or export_status");@@ -849,7 +872,9 @@ fn export_wait(/// `preview_frame`: the picture as an image, or the file written.fn preview(mut arguments: Value, backend: &mut dyn Backend) -> Result<Outcome, ApiError> {- let wants_file = arguments.get("output").is_some_and(|output| !output.is_null());+ let wants_file = arguments+ .get("output")+ .is_some_and(|output| !output.is_null());let sized = ["width", "height"].iter().all(|key| arguments.get(*key).is_some_and(|value| !value.is_null()));@@ -857,12 +882,24 @@ fn preview(mut arguments: Value, backend: &mut dyn Backend) -> Result<Outcome, A// The timeline's own frame, fitted within PREVIEW_SIDE.let path = arguments.get("path").cloned().unwrap_or(Value::Null);let view = backend.call(request("project.get", json!({ "path": path }))?)?;- let width = view.pointer("/settings/width").and_then(Value::as_f64).unwrap_or(1920.0);- let height = view.pointer("/settings/height").and_then(Value::as_f64).unwrap_or(1080.0);+ let width = view+ .pointer("/settings/width")+ .and_then(Value::as_f64)+ .unwrap_or(1920.0);+ let height = view+ .pointer("/settings/height")+ .and_then(Value::as_f64)+ .unwrap_or(1080.0);let scale = (PREVIEW_SIDE / width.max(height)).min(1.0);if let Some(fields) = arguments.as_object_mut() {- fields.insert("width".to_owned(), json!(((width * scale).round() as u32).max(1)));- fields.insert("height".to_owned(), json!(((height * scale).round() as u32).max(1)));+ fields.insert(+ "width".to_owned(),+ json!(((width * scale).round() as u32).max(1)),+ );+ fields.insert(+ "height".to_owned(),+ json!(((height * scale).round() as u32).max(1)),+ );}}let time = arguments.get("time").cloned().unwrap_or(Value::Null);@@ -878,7 +915,9 @@ fn preview(mut arguments: Value, backend: &mut dyn Backend) -> Result<Outcome, A"text": format!("The frame at {time} s, {}×{}.", result["width"], result["height"]),}),],- structured: Some(json!({ "width": result["width"], "height": result["height"], "time": time })),+ structured: Some(+ json!({ "width": result["width"], "height": result["height"], "time": time }),+ ),is_error: false,})}@@ -893,46 +932,124 @@ mod tests {vec![("concat_version", json!({})),("project_list", json!({})),- ("project_create", json!({ "location": "/tmp", "name": "Cut", "video": { "width": 1080, "height": 1920, "rateNum": 30, "rateDen": 1 } })),+ (+ "project_create",+ json!({ "location": "/tmp", "name": "Cut", "video": { "width": 1080, "height": 1920, "rateNum": 30, "rateDen": 1 } }),+ ),("project_open", json!({ "path": "/tmp/Cut" })),("project_save", json!({ "path": "/tmp/Cut" })),("project_close", json!({ "path": "/tmp/Cut", "save": true })),("timeline_read", json!({ "path": "/tmp/Cut" })),("project_get", json!({ "path": "/tmp/Cut" })),- ("project_set_video", json!({ "path": "/tmp/Cut", "video": { "width": 1920, "height": 1080, "rateNum": 30000, "rateDen": 1001 } })),+ (+ "project_set_video",+ json!({ "path": "/tmp/Cut", "video": { "width": 1920, "height": 1080, "rateNum": 30000, "rateDen": 1001 } }),+ ),("media_probe", json!({ "path": "/tmp/a.mp4" })),- ("media_import", json!({ "path": "/tmp/Cut", "file": "/tmp/a.mp4" })),- ("edit_apply", json!({ "path": "/tmp/Cut", "command": { "op": "addTrack" } })),+ (+ "media_import",+ json!({ "path": "/tmp/Cut", "file": "/tmp/a.mp4" }),+ ),+ (+ "edit_apply",+ json!({ "path": "/tmp/Cut", "command": { "op": "addTrack" } }),+ ),("edit_undo", json!({ "path": "/tmp/Cut" })),("edit_redo", json!({ "path": "/tmp/Cut" })),- ("clip_add", json!({ "path": "/tmp/Cut", "mediaId": "m1", "trackId": "t1", "start": 2.5 })),- ("clip_trim", json!({ "path": "/tmp/Cut", "clipId": "c1", "edge": "end", "delta": -1.0, "ripple": true })),- ("clips_split", json!({ "path": "/tmp/Cut", "clipIds": ["c1"], "time": 3.0 })),- ("clips_move", json!({ "path": "/tmp/Cut", "moves": [{ "clipId": "c1", "start": 0.0, "trackId": "t2" }] })),- ("clips_remove", json!({ "path": "/tmp/Cut", "clipIds": ["c1"], "ripple": false })),- ("clip_update", json!({ "path": "/tmp/Cut", "clipId": "c1", "patch": { "volume": 0.5, "crop": null, "transitionIn": { "id": "cross-fade", "duration": 0.5 }, "videoEffects": [{ "id": "concat.warm", "params": { "amount": 0.4 } }] } })),- ("clip_transform", json!({ "path": "/tmp/Cut", "clipId": "c1", "scale": 1.2, "rotation": 15.0 })),- ("clip_speed", json!({ "path": "/tmp/Cut", "clipId": "c1", "speed": 0.5 })),- ("title_add", json!({ "path": "/tmp/Cut", "start": 1.0, "duration": 3.0, "above": true, "style": { "content": "Hello", "fontSize": 0.08, "align": "left" }, "offsetY": -0.3 })),- ("captions_add", json!({ "path": "/tmp/Cut", "captions": [{ "start": 0.0, "end": 1.5, "text": "Hi" }], "style": { "color": "#ffff00" }, "offsetY": 0.3 })),- ("keyframe_set", json!({ "path": "/tmp/Cut", "clipId": "c1", "property": "scale", "at": 0.0, "value": 1.0, "ease": [0.42, 0.0, 0.58, 1.0] })),- ("keyframe_clear", json!({ "path": "/tmp/Cut", "clipId": "c1", "property": "opacity", "at": 1.0 })),- ("effect_layer_add", json!({ "path": "/tmp/Cut", "start": 0.0, "duration": 2.0, "effectId": "concat.warm", "name": "Warm", "trackId": null })),- ("effect_key_set", json!({ "path": "/tmp/Cut", "clipId": "c1", "entry": 0, "key": "amount", "at": 0.5, "value": 0.8 })),+ (+ "clip_add",+ json!({ "path": "/tmp/Cut", "mediaId": "m1", "trackId": "t1", "start": 2.5 }),+ ),+ (+ "clip_trim",+ json!({ "path": "/tmp/Cut", "clipId": "c1", "edge": "end", "delta": -1.0, "ripple": true }),+ ),+ (+ "clips_split",+ json!({ "path": "/tmp/Cut", "clipIds": ["c1"], "time": 3.0 }),+ ),+ (+ "clips_move",+ json!({ "path": "/tmp/Cut", "moves": [{ "clipId": "c1", "start": 0.0, "trackId": "t2" }] }),+ ),+ (+ "clips_remove",+ json!({ "path": "/tmp/Cut", "clipIds": ["c1"], "ripple": false }),+ ),+ (+ "clip_update",+ json!({ "path": "/tmp/Cut", "clipId": "c1", "patch": { "volume": 0.5, "crop": null, "transitionIn": { "id": "cross-fade", "duration": 0.5 }, "videoEffects": [{ "id": "concat.warm", "params": { "amount": 0.4 } }] } }),+ ),+ (+ "clip_transform",+ json!({ "path": "/tmp/Cut", "clipId": "c1", "scale": 1.2, "rotation": 15.0 }),+ ),+ (+ "clip_speed",+ json!({ "path": "/tmp/Cut", "clipId": "c1", "speed": 0.5 }),+ ),+ (+ "title_add",+ json!({ "path": "/tmp/Cut", "start": 1.0, "duration": 3.0, "above": true, "style": { "content": "Hello", "fontSize": 0.08, "align": "left" }, "offsetY": -0.3 }),+ ),+ (+ "captions_add",+ json!({ "path": "/tmp/Cut", "captions": [{ "start": 0.0, "end": 1.5, "text": "Hi" }], "style": { "color": "#ffff00" }, "offsetY": 0.3 }),+ ),+ (+ "keyframe_set",+ json!({ "path": "/tmp/Cut", "clipId": "c1", "property": "scale", "at": 0.0, "value": 1.0, "ease": [0.42, 0.0, 0.58, 1.0] }),+ ),+ (+ "keyframe_clear",+ json!({ "path": "/tmp/Cut", "clipId": "c1", "property": "opacity", "at": 1.0 }),+ ),+ (+ "effect_layer_add",+ json!({ "path": "/tmp/Cut", "start": 0.0, "duration": 2.0, "effectId": "concat.warm", "name": "Warm", "trackId": null }),+ ),+ (+ "effect_key_set",+ json!({ "path": "/tmp/Cut", "clipId": "c1", "entry": 0, "key": "amount", "at": 0.5, "value": 0.8 }),+ ),("track_add", json!({ "path": "/tmp/Cut", "bottom": false })),- ("clips_add_sequence", json!({ "path": "/tmp/Cut", "mediaIds": ["m1", "m2"], "start": 0.0 })),- ("clip_mask", json!({ "path": "/tmp/Cut", "clipId": "c1", "mask": { "shape": "heart", "width": 0.5, "feather": 0.1, "invert": true } })),- ("clip_stabilize", json!({ "path": "/tmp/Cut", "clipId": "c1", "stabilize": { "smoothness": 0.7, "maxZoom": 1.2, "tripod": false } })),- ("clip_frame", json!({ "path": "/tmp/Cut", "clipId": "c1", "framing": "fill" })),- ("timeline_background", json!({ "path": "/tmp/Cut", "timelineId": "tl1", "background": { "kind": "blur", "amount": 0.5 } })),+ (+ "clips_add_sequence",+ json!({ "path": "/tmp/Cut", "mediaIds": ["m1", "m2"], "start": 0.0 }),+ ),+ (+ "clip_mask",+ json!({ "path": "/tmp/Cut", "clipId": "c1", "mask": { "shape": "heart", "width": 0.5, "feather": 0.1, "invert": true } }),+ ),+ (+ "clip_stabilize",+ json!({ "path": "/tmp/Cut", "clipId": "c1", "stabilize": { "smoothness": 0.7, "maxZoom": 1.2, "tripod": false } }),+ ),+ (+ "clip_frame",+ json!({ "path": "/tmp/Cut", "clipId": "c1", "framing": "fill" }),+ ),+ (+ "timeline_background",+ json!({ "path": "/tmp/Cut", "timelineId": "tl1", "background": { "kind": "blur", "amount": 0.5 } }),+ ),("effects_list", json!({ "kind": "transition" })),("template_list", json!({})),- ("template_instantiate", json!({ "template": "/t", "location": "/tmp", "name": "From", "fills": [{ "mediaId": "m1", "file": "/tmp/a.mp4" }] })),- ("export_start", json!({ "path": "/tmp/Cut", "output": "/tmp/cut.mp4", "crf": 23, "codec": "h264" })),+ (+ "template_instantiate",+ json!({ "template": "/t", "location": "/tmp", "name": "From", "fills": [{ "mediaId": "m1", "file": "/tmp/a.mp4" }] }),+ ),+ (+ "export_start",+ json!({ "path": "/tmp/Cut", "output": "/tmp/cut.mp4", "crf": 23, "codec": "h264" }),+ ),("export_status", json!({ "job": "j1" })),("export_wait", json!({ "job": "j1", "timeoutSeconds": 5 })),("export_cancel", json!({ "job": "j1" })),- ("preview_frame", json!({ "path": "/tmp/Cut", "time": 1.5, "width": 320, "height": 180 })),+ (+ "preview_frame",+ json!({ "path": "/tmp/Cut", "time": 1.5, "width": 320, "height": 180 }),+ ),]}@@ -942,7 +1059,10 @@ mod tests {let listed = toolbox.list();let samples = samples();assert_eq!(listed.len(), samples.len(), "a sample for every tool");- let mut names: Vec<&str> = listed.iter().filter_map(|tool| tool["name"].as_str()).collect();+ let mut names: Vec<&str> = listed+ .iter()+ .filter_map(|tool| tool["name"].as_str())+ .collect();names.sort_unstable();names.dedup();assert_eq!(names.len(), listed.len(), "unique names");@@ -953,7 +1073,12 @@ mod tests {"{name}");assert_eq!(tool["inputSchema"]["type"], "object", "{name}");- assert!(tool["description"].as_str().is_some_and(|text| text.len() > 40), "{name}");+ assert!(+ tool["description"]+ .as_str()+ .is_some_and(|text| text.len() > 40),+ "{name}"+ );}}@@ -973,7 +1098,9 @@ mod tests {Action::Captions => captions(sample.clone()),Action::ExportWait => {let mut sample = sample.clone();- sample.as_object_mut().map(|fields| fields.remove("timeoutSeconds"));+ sample+ .as_object_mut()+ .map(|fields| fields.remove("timeoutSeconds"));request("export.status", sample)}Action::PreviewFrame => request("preview.frame", sample.clone()),@@ -998,6 +1125,9 @@ mod tests {assert_eq!(error.code, ErrorCode::Invalid);let missing = request("project.open", json!({}));assert!(missing.expect_err("refused").message.contains("path"));- assert!(captions(json!({ "path": "/p", "captions": [{ "start": 2, "end": 1, "text": "x" }] })).is_err());+ assert!(+ captions(json!({ "path": "/p", "captions": [{ "start": 2, "end": 1, "text": "x" }] }))+ .is_err()+ );}}diff --git a/src/crates/concat-mcp/tests/e2e.rs b/src/crates/concat-mcp/tests/e2e.rsindex 86c5d428..7d769b8c 100644--- a/src/crates/concat-mcp/tests/e2e.rs+++ b/src/crates/concat-mcp/tests/e2e.rs@@ -96,8 +96,14 @@ impl Agent {/// A tool's result: its structured content when it has some, its text/// otherwise. Fails on a protocol error.fn tool(&mut self, name: &str, arguments: Value) -> Value {- let (_, reply) = self.ask("tools/call", json!({ "name": name, "arguments": arguments }));- let result = reply.get("result").unwrap_or_else(|| panic!("{name}: {reply}")).clone();+ let (_, reply) = self.ask(+ "tools/call",+ json!({ "name": name, "arguments": arguments }),+ );+ let result = reply+ .get("result")+ .unwrap_or_else(|| panic!("{name}: {reply}"))+ .clone();assert_eq!(result["isError"], false, "{name}: {result}");result}@@ -135,12 +141,22 @@ fn an_agent_edits_previews_and_exports_a_project_headless() {assert_eq!(welcome["protocolVersion"], "2025-06-18");assert_eq!(welcome["serverInfo"]["name"], "concat");assert!(welcome["capabilities"]["tools"].is_object());- assert!(welcome["instructions"].as_str().is_some_and(|text| text.contains("project")));+ assert!(+ welcome["instructions"]+ .as_str()+ .is_some_and(|text| text.contains("project"))+ );agent.send(&json!({ "jsonrpc": "2.0", "method": "notifications/initialized" }));let (_, listed) = agent.ask("tools/list", json!({}));let tools = listed["result"]["tools"].as_array().expect("tools");- for name in ["project_create", "edit_apply", "title_add", "preview_frame", "export_wait"] {+ for name in [+ "project_create",+ "edit_apply",+ "title_add",+ "preview_frame",+ "export_wait",+ ] {let tool = tools.iter().find(|tool| tool["name"] == name)@@ -197,10 +213,16 @@ fn an_agent_edits_previews_and_exports_a_project_headless() {.expect("clips").clone();assert_eq!(clips.len(), 3, "{read}");- let first = clips.iter().find(|clip| clip["id"] == title).expect("the title");+ let first = clips+ .iter()+ .find(|clip| clip["id"] == title)+ .expect("the title");assert_eq!(first["text"], "Hello, agent");assert_eq!(first["keyframed"], json!(["opacity"]));- assert_eq!(keyed["structuredContent"]["timeline"], read["structuredContent"]["timeline"]);+ assert_eq!(+ keyed["structuredContent"]["timeline"],+ read["structuredContent"]["timeline"]+ );// A wrong argument is the agent's to correct: a tool error, not a// protocol one.@@ -209,7 +231,10 @@ fn an_agent_edits_previews_and_exports_a_project_headless() {json!({ "name": "clip_speed", "arguments": { "path": path, "clipId": title, "speed": "fast" } }),);assert_eq!(wrong["result"]["isError"], true, "{wrong}");- let (_, unknown) = agent.ask("tools/call", json!({ "name": "make_it_pop", "arguments": {} }));+ let (_, unknown) = agent.ask(+ "tools/call",+ json!({ "name": "make_it_pop", "arguments": {} }),+ );assert_eq!(unknown["error"]["code"], -32602);let undone = agent.tool("edit_undo", json!({ "path": path }));@@ -218,24 +243,35 @@ fn an_agent_edits_previews_and_exports_a_project_headless() {.and_then(|clips| clips.iter().find(|clip| clip["id"] == title)).expect("the title").clone();- assert!(after_undo.get("keyframed").is_none(), "the key is undone: {after_undo}");+ assert!(+ after_undo.get("keyframed").is_none(),+ "the key is undone: {after_undo}"+ );let frame = agent.tool("preview_frame", json!({ "path": path, "time": 0.25 }));let image = &frame["content"][0];assert_eq!(image["type"], "image");assert_eq!(image["mimeType"], "image/png");assert!(- image["data"].as_str().is_some_and(|data| data.starts_with("iVBORw0KGgo")),+ image["data"]+ .as_str()+ .is_some_and(|data| data.starts_with("iVBORw0KGgo")),"a PNG");- assert_eq!(frame["structuredContent"]["width"], 320, "the timeline's own size fits");+ assert_eq!(+ frame["structuredContent"]["width"], 320,+ "the timeline's own size fits"+ );agent.tool("project_save", json!({ "path": path }));let saved = std::fs::read_to_string(Path::new(&path).join("concat.json")).expect("saved");assert!(saved.contains("Hello, agent"));let output = home.join("agent.mp4").to_string_lossy().into_owned();- let started = agent.tool("export_start", json!({ "path": path, "output": output, "preset": "ultrafast" }));+ let started = agent.tool(+ "export_start",+ json!({ "path": path, "output": output, "preset": "ultrafast" }),+ );let job = started["structuredContent"]["job"].clone();assert_eq!(job, "j1");let (notes, waited) = agent.ask(@@ -292,11 +328,18 @@ fn a_modern_client_discovers_and_is_told_which_versions_are_spoken() {.as_array().is_some_and(|versions| versions.contains(&json!("2026-07-28"))));- assert_eq!(result["_meta"]["io.modelcontextprotocol/serverInfo"]["name"], "concat");+ assert_eq!(+ result["_meta"]["io.modelcontextprotocol/serverInfo"]["name"],+ "concat"+ );let (_, listed) = agent.ask("tools/list", json!({ "_meta": meta("2026-07-28") }));assert_eq!(listed["result"]["resultType"], "complete");- assert!(listed["result"]["tools"].as_array().is_some_and(|tools| tools.len() > 20));+ assert!(+ listed["result"]["tools"]+ .as_array()+ .is_some_and(|tools| tools.len() > 20)+ );let (_, refused) = agent.ask("tools/list", json!({ "_meta": meta("1900-01-01") }));assert_eq!(refused["error"]["code"], -32022);diff --git a/src/crates/concat-project/src/commands/clips.rs b/src/crates/concat-project/src/commands/clips.rsindex 0da125f0..c6fad09a 100644--- a/src/crates/concat-project/src/commands/clips.rs+++ b/src/crates/concat-project/src/commands/clips.rs@@ -73,7 +73,12 @@ pub(super) fn apply(} => {let items = media_ids.iter()- .map(|id| project.media_by_id(id).cloned().ok_or(CommandError::MediaGone))+ .map(|id| {+ project+ .media_by_id(id)+ .cloned()+ .ok_or(CommandError::MediaGone)+ }).collect::<Result<Vec<_>, _>>()?;if items.is_empty() {return Ok(Outcome {diff --git a/src/crates/concat-project/src/commands/properties.rs b/src/crates/concat-project/src/commands/properties.rsindex c54adfdb..d8cc3172 100644--- a/src/crates/concat-project/src/commands/properties.rs+++ b/src/crates/concat-project/src/commands/properties.rs@@ -143,10 +143,7 @@ pub(super) fn apply(})}- Command::SetClipStabilize {- clip_id,- stabilize,- } => {+ Command::SetClipStabilize { clip_id, stabilize } => {let timeline = project.active_mut();let Some(clip) = timeline.clip_mut(&clip_id) else {return Ok(Outcome::default());diff --git a/src/crates/concat-project/src/lib.rs b/src/crates/concat-project/src/lib.rsindex e7188813..147c97ea 100644--- a/src/crates/concat-project/src/lib.rs+++ b/src/crates/concat-project/src/lib.rs@@ -4099,7 +4099,11 @@ mod tests {);}assert!(editor.undo(), "undoes");- assert_eq!(editor.project().active().clips.len(), before, "one undo step");+ assert_eq!(+ editor.project().active().clips.len(),+ before,+ "one undo step"+ );}#[test]diff --git a/src/crates/concat-project/src/model.rs b/src/crates/concat-project/src/model.rsindex 3f7de152..04414998 100644--- a/src/crates/concat-project/src/model.rs+++ b/src/crates/concat-project/src/model.rs@@ -2071,11 +2071,7 @@ impl Clip {KeyProperty::Volume => self.volume,// A clip with no mask answers with a new one's numbers, so a// panel opening on it shows what the first shape will start at.- mask => self- .mask- .unwrap_or_default()- .get(mask)- .unwrap_or_default(),+ mask => self.mask.unwrap_or_default().get(mask).unwrap_or_default(),}}@@ -2135,7 +2131,10 @@ impl Clip {KeyProperty::Volume => self.volume = value,// The mask's numbers are the mask's; a number written on a// clip with none puts one on, the shape a new one starts as.- mask => self.mask.get_or_insert_with(ClipMask::default).set(mask, value),+ mask => self+ .mask+ .get_or_insert_with(ClipMask::default)+ .set(mask, value),}}diff --git a/src/crates/concat-render/src/lib.rs b/src/crates/concat-render/src/lib.rsindex 2cf68820..89fb0c09 100644--- a/src/crates/concat-render/src/lib.rs+++ b/src/crates/concat-render/src/lib.rs@@ -31,8 +31,7 @@ pub use compositor::Compositor;pub use gpu::WgpuCompositor;pub use metrics::ssim;pub use plan::{- Backdrop, Crop, FramePlan, Geometry, PlannedLayer, PlannedTreatment, Shading, Transition,- Warp,+ Backdrop, Crop, FramePlan, Geometry, PlannedLayer, PlannedTreatment, Shading, Transition, Warp,detached_clip, plan_frame,};#[cfg(test)]diff --git a/src/crates/concat-server/src/client.rs b/src/crates/concat-server/src/client.rsindex 0d835d1b..117f24e5 100644--- a/src/crates/concat-server/src/client.rs+++ b/src/crates/concat-server/src/client.rs@@ -86,7 +86,9 @@ impl Client {self.next_id += 1;let line = json!({ "jsonrpc": "2.0", "id": id, "method": method, "params": params });let gone = |error: &dyn std::fmt::Display| {- ApiError::failed(format!("the connection to the Concat server failed: {error}"))+ ApiError::failed(format!(+ "the connection to the Concat server failed: {error}"+ ))};writeln!(self.writer, "{line}").map_err(|error| gone(&error))?;self.writer.flush().map_err(|error| gone(&error))?;diff --git a/src/crates/concat-server/src/discovery.rs b/src/crates/concat-server/src/discovery.rsindex 561077f2..124482e0 100644--- a/src/crates/concat-server/src/discovery.rs+++ b/src/crates/concat-server/src/discovery.rs@@ -74,9 +74,8 @@ impl Listing {/// was there in one step: written beside it and renamed over it, so a/// reader sees the old file or the new one and never half of either.pub fn write(path: &Path, listing: &Listing) -> Result<(), String> {- let could_not = |error: &dyn std::fmt::Display| {- format!("could not write {}: {error}", path.display())- };+ let could_not =+ |error: &dyn std::fmt::Display| format!("could not write {}: {error}", path.display());if let Some(parent) = path.parent() {std::fs::create_dir_all(parent).map_err(|error| could_not(&error))?;}@@ -151,13 +150,19 @@ mod tests {let path = path_in(&scratch.path().join("config"));assert_eq!(read(&path), Ok(None));let listing = Listing::new("0.0.0.0:7420".parse().expect("an address"), "t0ken");- assert_eq!(listing.address, "127.0.0.1:7420".parse().expect("an address"));+ assert_eq!(+ listing.address,+ "127.0.0.1:7420".parse().expect("an address")+ );write(&path, &listing).expect("writes");assert_eq!(read(&path), Ok(Some(listing.clone())));#[cfg(unix)]{use std::os::unix::fs::PermissionsExt;- let mode = std::fs::metadata(&path).expect("there").permissions().mode();+ let mode = std::fs::metadata(&path)+ .expect("there")+ .permissions()+ .mode();assert_eq!(mode & 0o777, 0o600, "{mode:o}");}// Someone else's listing stays.diff --git a/src/crates/concat-server/src/grpc.rs b/src/crates/concat-server/src/grpc.rsindex f1a976c9..83bc101d 100644--- a/src/crates/concat-server/src/grpc.rs+++ b/src/crates/concat-server/src/grpc.rs@@ -160,7 +160,8 @@ pub(crate) fn serve(return;};let incoming = tokio_stream::wrappers::TcpListenerStream::new(listener);- let service = ConcatServer::with_interceptor(Service { hub }, bearer(token, throttle));+ let service =+ ConcatServer::with_interceptor(Service { hub }, bearer(token, throttle));let stopped = async move {while !stop.load(Ordering::SeqCst) {tokio::time::sleep(Duration::from_millis(100)).await;diff --git a/src/crates/concat-server/src/json.rs b/src/crates/concat-server/src/json.rsindex eb90746d..321efb49 100644--- a/src/crates/concat-server/src/json.rs+++ b/src/crates/concat-server/src/json.rs@@ -427,8 +427,7 @@ impl Outbox {.name(format!("concat json {id} out")).spawn(move || {for message in messages {- if writeln!(writer, "{}", message.to_json()).is_err()- || writer.flush().is_err()+ if writeln!(writer, "{}", message.to_json()).is_err() || writer.flush().is_err(){// Gone, or stalled past the write timeout: hang up// so the reader ends too, and drop the queue so@@ -567,7 +566,10 @@ mod tests {assert!(late.closed());drop(seated);// A seat given back is taken again.- assert!(eventually(|| server.connections() == 0), "the seats come back");+ assert!(+ eventually(|| server.connections() == 0),+ "the seats come back"+ );let _back = Client::connect(&server);server.stop();}@@ -628,7 +630,9 @@ mod tests {let client = Client::connect(&server);drop(client);}- assert!(eventually(|| server.registered() == 0 && server.connections() == 0));+ assert!(eventually(+ || server.registered() == 0 && server.connections() == 0+ ));assert_eq!(server.hub().subscribers(), 0, "nobody left subscribed");server.stop();}@@ -659,7 +663,10 @@ mod tests {assert_eq!(reply["id"], 2);// A clean slate: one more wrong token is forgiven again.let mut slip = Client::reach(&server);- assert_eq!(slip.auth("still not it, sorry")["error"]["message"], "wrong token");+ assert_eq!(+ slip.auth("still not it, sorry")["error"]["message"],+ "wrong token"+ );let _ = Client::connect(&server);server.stop();}diff --git a/src/crates/concat-server/src/lib.rs b/src/crates/concat-server/src/lib.rsindex 63f03f20..130fed1c 100644--- a/src/crates/concat-server/src/lib.rs+++ b/src/crates/concat-server/src/lib.rs@@ -274,7 +274,8 @@ impl Server {.map_err(|error| could_not(&shown, &error))?;server.socket = Some(path);server.listeners.push(- json::serve_unix(listener, door.clone()).map_err(|error| could_not(&shown, &error))?,+ json::serve_unix(listener, door.clone())+ .map_err(|error| could_not(&shown, &error))?,);}diff --git a/src/crates/concat-server/src/throttle.rs b/src/crates/concat-server/src/throttle.rsindex 4b75aa9e..6a8317a0 100644--- a/src/crates/concat-server/src/throttle.rs+++ b/src/crates/concat-server/src/throttle.rs@@ -55,7 +55,10 @@ impl Throttle {/// How long `peer` must still wait before a token from it is read;/// `None` when it need not.pub fn wait(&self, peer: Peer) -> Option<Duration> {- let peers = self.peers.lock().unwrap_or_else(|poisoned| poisoned.into_inner());+ let peers = self+ .peers+ .lock()+ .unwrap_or_else(|poisoned| poisoned.into_inner());let strikes = peers.get(&peer)?;strikes.until@@ -66,7 +69,10 @@ impl Throttle {/// `peer` presented a wrong token.pub fn failed(&self, peer: Peer) {let now = Instant::now();- let mut peers = self.peers.lock().unwrap_or_else(|poisoned| poisoned.into_inner());+ let mut peers = self+ .peers+ .lock()+ .unwrap_or_else(|poisoned| poisoned.into_inner());if peers.len() >= MAX_PEERS && !peers.contains_key(&peer) {peers.retain(|_, strikes| now.duration_since(strikes.last) < MEMORY);if peers.len() >= MAX_PEERS {@@ -106,9 +112,7 @@ pub fn wait_after(failures: u32) -> Duration {return Duration::ZERO;}let doublings = (failures - FREE_FAILURES - 1).min(16);- FIRST_WAIT- .saturating_mul(1 << doublings)- .min(LONGEST_WAIT)+ FIRST_WAIT.saturating_mul(1 << doublings).min(LONGEST_WAIT)}#[cfg(test)]diff --git a/src/crates/concat-server/src/token.rs b/src/crates/concat-server/src/token.rsindex 9635eb1b..ff09ec94 100644--- a/src/crates/concat-server/src/token.rs+++ b/src/crates/concat-server/src/token.rs@@ -104,7 +104,11 @@ mod tests {fn a_weak_token_is_refused_and_a_minted_one_is_not() {for _ in 0..64 {let minted = mint().expect("mints");- assert!(check(&minted).is_ok(), "{minted}: {}", estimated_bits(&minted));+ assert!(+ check(&minted).is_ok(),+ "{minted}: {}",+ estimated_bits(&minted)+ );}for weak in ["",diff --git a/src/crates/concat/src/lib.rs b/src/crates/concat/src/lib.rsindex 03c7bb95..3d8dfcd5 100644--- a/src/crates/concat/src/lib.rs+++ b/src/crates/concat/src/lib.rs@@ -229,9 +229,7 @@ fn start(project: Option<std::path::PathBuf>, smoke: bool) -> Result<(), slint::// not up, into the project's bin.let to_library = studio.sounds.shown&& !paths.is_empty()- && paths- .iter()- .all(|path| concat_host::sounds::is_sound(path));+ && paths.iter().all(|path| concat_host::sounds::is_sound(path));if studio.on_start {// On the launch screen there is no project to// import into: a dropped project opens, and media@@ -1423,8 +1421,7 @@ fn start(project: Option<std::path::PathBuf>, smoke: bool) -> Result<(), slint::app.on_speech_clear_style(on_window!(|state| {state.handle(Msg::Speech(SpeechMsg::ClearStyle));}));- {- }+ {}app.global::<SourcePreview>().on_seek(on_window!(|state, seconds: f32| {state.source_seek(f64::from(seconds));diff --git a/src/crates/concat/src/main.rs b/src/crates/concat/src/main.rsindex f700494c..91cb743e 100644--- a/src/crates/concat/src/main.rs+++ b/src/crates/concat/src/main.rs@@ -47,7 +47,7 @@ fn main() -> Result<(), slint::PlatformError> {.and_then(|word| concat_mcp::Mode::parse(&word))}).unwrap_or_default();- let _ =concat_host::logs::open_console(None);+ let _ = concat_host::logs::open_console(None);return concat_mcp::run(mode).map_err(|error| {log::error!("mcp: {error}");slint::PlatformError::Other(error)diff --git a/src/crates/concat/src/panes/settings.rs b/src/crates/concat/src/panes/settings.rsindex 0bee5f8f..c4e2a613 100644--- a/src/crates/concat/src/panes/settings.rs+++ b/src/crates/concat/src/panes/settings.rs@@ -635,10 +635,7 @@ impl SettingsPane {// stays on and the server waits for it, rather than the switch// flipping off at the first keystroke.if !prefs.token.is_empty() && concat_server::check_token(&prefs.token).is_err() {- self.server_error = tf(- "settings.tokenTooWeak",- &[&concat_server::MIN_TOKEN_CHARS],- );+ self.server_error = tf("settings.tokenTooWeak", &[&concat_server::MIN_TOKEN_CHARS]);return;}let started = prefsdiff --git a/src/crates/concat/src/panes/sounds.rs b/src/crates/concat/src/panes/sounds.rsindex d4aa08ff..550eba6c 100644--- a/src/crates/concat/src/panes/sounds.rs+++ b/src/crates/concat/src/panes/sounds.rs@@ -210,10 +210,7 @@ impl SoundsPane {let (taken, refused): (Vec<PathBuf>, Vec<PathBuf>) =paths.into_iter().partition(|path| sounds::is_sound(path));if let Some(path) = refused.first() {- studio.notify(- &tf("sounds.notASound", &[&display_name(path)]),- true,- );+ studio.notify(&tf("sounds.notASound", &[&display_name(path)]), true);}if taken.is_empty() {return;@@ -355,14 +352,19 @@ impl SoundsPane {/// The Concat shelf's rows, narrowed to the category picked.pub fn concat_rows(&self) -> Vec<SoundCardData> {- let category = self.category.checked_sub(1).and_then(|row| CATEGORIES.get(row));+ let category = self+ .category+ .checked_sub(1)+ .and_then(|row| CATEGORIES.get(row));let Some(dirs) = self.dirs.as_ref() else {return Vec::new();};self.catalogue.sounds.iter()- .filter(|sound| category.is_none_or(|wanted| sound.category.eq_ignore_ascii_case(wanted)))+ .filter(|sound| {+ category.is_none_or(|wanted| sound.category.eq_ignore_ascii_case(wanted))+ }).map(|sound| {let card = format!("{CONCAT}{}", sound.id);let progress = self.fetching.get(&card).map_or(-1.0, |(done, _)| *done);@@ -437,7 +439,14 @@ fn display_name(path: &Path) -> String {impl Studio {/// The Voices shelf: the user's saved clones, the speakers of the voice/// models on disk, and the styles; and whether any model is on disk.- pub fn voice_cards(&self) -> (Vec<VoiceCardData>, Vec<VoiceCardData>, Vec<VoiceCardData>, bool) {+ pub fn voice_cards(+ &self,+ ) -> (+ Vec<VoiceCardData>,+ Vec<VoiceCardData>,+ Vec<VoiceCardData>,+ bool,+ ) {use crate::panes::speech::{STYLES, letter_avatar, voice_names};let saved = self.speechdiff --git a/src/crates/concat/src/panes/speech.rs b/src/crates/concat/src/panes/speech.rsindex 1d7f113e..e7cb944e 100644--- a/src/crates/concat/src/panes/speech.rs+++ b/src/crates/concat/src/panes/speech.rs@@ -30,8 +30,7 @@ use concat_project::commands::ClipPatch;use concat_project::model::{AppliedFilter, ClipKind, MediaItem, MediaOrigin};use concat_speech::JobStage;use concat_speech::tts::{- CHATTERBOX_CLONE, Family, POCKET_CLONE, Reference, VoiceInfo, family_of, is_clone,- voice_family,+ CHATTERBOX_CLONE, Family, POCKET_CLONE, Reference, VoiceInfo, family_of, is_clone, voice_family,};use slint::SharedString;@@ -726,7 +725,11 @@ impl SpeechPane {self.offered().iter().map(|speaker| voice_label(&speaker.name).0.into())- .chain(self.saved_rows().iter().map(|voice| voice.name.as_str().into()))+ .chain(+ self.saved_rows()+ .iter()+ .map(|voice| voice.name.as_str().into()),+ ).chain(self.clone_row().then(|| t("speech.cloneFromSample").into())).collect()}@@ -737,7 +740,11 @@ impl SpeechPane {self.offered().iter().map(|speaker| voice_label(&speaker.name).1.into())- .chain(self.saved_rows().iter().map(|_| t("speech.savedVoice").into()))+ .chain(+ self.saved_rows()+ .iter()+ .map(|_| t("speech.savedVoice").into()),+ ).chain(self.clone_row().then(|| t("speech.fromRecordingInBin").into()),@@ -764,7 +771,11 @@ impl SpeechPane {picture: picture.unwrap_or_default(),}})- .chain(self.saved_rows().iter().map(|voice| self.saved_avatar(voice)))+ .chain(+ self.saved_rows()+ .iter()+ .map(|voice| self.saved_avatar(voice)),+ ).chain(self.clone_row().then(|| crate::ui::AvatarData {letter: "+".into(),hue: -1,