File tree Expand file tree Collapse file tree 3 files changed +15
-15
lines changed
Expand file tree Collapse file tree 3 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ use axum::{
55 response:: { IntoResponse , Response } ,
66} ;
77
8+ #[ allow( unused) ]
89pub struct AppError ( anyhow:: Error ) ;
910
1011// Tell axum how to convert `AppError` into a response.
Original file line number Diff line number Diff line change @@ -41,12 +41,12 @@ impl Service for AzureTranslate {
4141 sample_rate : 16000 ,
4242 } ;
4343
44- if let Some ( audio_format) = output_modalities. audio {
45- if audio_format != AUDIO_OUTPUT_FORMAT {
46- bail ! (
47- "Only {AUDIO_OUTPUT_FORMAT:?} is supported, but output modalities contains {audio_format:?}"
48- ) ;
49- }
44+ if let Some ( audio_format) = output_modalities. audio
45+ && audio_format != AUDIO_OUTPUT_FORMAT
46+ {
47+ bail ! (
48+ "Only {AUDIO_OUTPUT_FORMAT:?} is supported, but output modalities contains {audio_format:?}"
49+ ) ;
5050 }
5151
5252 // Host / Auth is lightweight, so we can create this every time.
Original file line number Diff line number Diff line change @@ -31,17 +31,16 @@ impl io::Read for StreamReader {
3131 }
3232
3333 // If we have a current chunk with remaining data, use it
34- if let Some ( ref chunk) = self . current_chunk {
35- if self . chunk_offset < chunk. len ( ) {
36- let remaining_in_chunk = chunk. len ( ) - self . chunk_offset ;
37- let to_copy = std:: cmp:: min ( buf. len ( ) , remaining_in_chunk) ;
34+ if let Some ( ref chunk) = self . current_chunk
35+ && self . chunk_offset < chunk. len ( )
36+ {
37+ let remaining_in_chunk = chunk. len ( ) - self . chunk_offset ;
38+ let to_copy = std:: cmp:: min ( buf. len ( ) , remaining_in_chunk) ;
3839
39- buf[ ..to_copy]
40- . copy_from_slice ( & chunk[ self . chunk_offset ..self . chunk_offset + to_copy] ) ;
41- self . chunk_offset += to_copy;
40+ buf[ ..to_copy] . copy_from_slice ( & chunk[ self . chunk_offset ..self . chunk_offset + to_copy] ) ;
41+ self . chunk_offset += to_copy;
4242
43- return Ok ( to_copy) ;
44- }
43+ return Ok ( to_copy) ;
4544 }
4645
4746 // Need to get the next chunk from the stream
You can’t perform that action at this time.
0 commit comments