Skip to content

Commit 24bfbef

Browse files
committed
chore: lint
1 parent 7533042 commit 24bfbef

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

apps/silero-vad-whisper-realtime-api/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ impl AppState {
7474
{
7575
let models = self.whisper_models.read().await;
7676
if let Some(processor) = models.get(model_name) {
77-
println!("🔄 Using cached Whisper model: {}", model_name);
77+
println!("🔄 Using cached Whisper model: {model_name}");
7878
return Ok(processor.clone());
7979
}
8080
}
8181

8282
// If not in cache, create new model with timing
8383
let loading_start = std::time::Instant::now();
84-
println!("🧠 Loading new Whisper model: {}", model_name);
84+
println!("🧠 Loading new Whisper model: {model_name}");
8585

8686
let whisper_model = Self::parse_model_name(model_name)?;
8787
let processor = Arc::new(Mutex::new(WhisperProcessor::new(whisper_model, self.device.clone())?));

apps/silero-vad-whisper-realtime-api/src/router.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl ProcessingStats {
6767
println!(" 🎵 Audio length: {:.2}s", self.audio_length_seconds);
6868
if self.audio_length_seconds > 0.0 {
6969
let real_time_factor = self.total_duration.as_secs_f64() / self.audio_length_seconds as f64;
70-
println!(" ⚡ Real-time factor: {:.2}x", real_time_factor);
70+
println!(" ⚡ Real-time factor: {real_time_factor:.2}x");
7171
}
7272
}
7373
}
@@ -87,7 +87,7 @@ pub async fn transcribe_audio(
8787
StatusCode::BAD_REQUEST,
8888
Json(ErrorResponse {
8989
error: ErrorDetail {
90-
message: format!("Failed to extract form data: {}", e),
90+
message: format!("Failed to extract form data: {e}"),
9191
error_type: "invalid_request_error".to_string(),
9292
param: Some("form".to_string()),
9393
code: None,
@@ -97,7 +97,7 @@ pub async fn transcribe_audio(
9797
},
9898
};
9999

100-
println!("Request params: {:?}", params);
100+
println!("Request params: {params:?}");
101101

102102
// Parse streaming parameter from form data
103103
let stream_enabled = params
@@ -107,11 +107,10 @@ pub async fn transcribe_audio(
107107

108108
// Get model name from parameters and clone it to make it owned
109109
let model_name = params
110-
.get("model")
111-
.map(|s| s.clone()) // Clone to make it owned
110+
.get("model").cloned() // Clone to make it owned
112111
.unwrap_or_else(|| "tiny".to_string()); // Use tiny as default
113112

114-
println!("Using model: {}, streaming: {}", model_name, stream_enabled);
113+
println!("Using model: {model_name}, streaming: {stream_enabled}");
115114

116115
// Convert audio to PCM format with timing
117116
let conversion_start = Instant::now();
@@ -122,7 +121,7 @@ pub async fn transcribe_audio(
122121
StatusCode::BAD_REQUEST,
123122
Json(ErrorResponse {
124123
error: ErrorDetail {
125-
message: format!("Failed to process audio file: {}", e),
124+
message: format!("Failed to process audio file: {e}"),
126125
error_type: "invalid_request_error".to_string(),
127126
param: Some("file".to_string()),
128127
code: None,
@@ -156,7 +155,7 @@ pub async fn transcribe_audio(
156155
StatusCode::INTERNAL_SERVER_ERROR,
157156
Json(ErrorResponse {
158157
error: ErrorDetail {
159-
message: format!("Transcription failed: {}", e),
158+
message: format!("Transcription failed: {e}"),
160159
error_type: "server_error".to_string(),
161160
param: None,
162161
code: None,
@@ -321,7 +320,7 @@ async fn create_transcription_stream(
321320
StatusCode::BAD_REQUEST,
322321
Json(ErrorResponse {
323322
error: ErrorDetail {
324-
message: format!("Failed to load model '{}': {}", model_name, e),
323+
message: format!("Failed to load model '{model_name}': {e}"),
325324
error_type: "invalid_request_error".to_string(),
326325
param: Some("model".to_string()),
327326
code: None,

0 commit comments

Comments
 (0)