From f9dc3cf7a5ec22dc7be759734faf8bc4d58ab41f Mon Sep 17 00:00:00 2001 From: Cliff Dyer Date: Wed, 3 Jul 2024 15:57:30 -0400 Subject: [PATCH] fmt --- src/lib.rs | 5 ++++- src/transcription/live.rs | 14 ++++++-------- src/transcription/prerecorded.rs | 14 +++++++++----- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index d45e1f8a..3c6c2a4e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,7 +36,10 @@ static DEEPGRAM_BASE_URL: &str = "https://api.deepgram.com"; pub struct Deepgram { #[cfg_attr(not(feature = "live"), allow(unused))] api_key: String, - #[cfg_attr(all(not(feature = "live"), not(feature = "prerecorded")), allow(unused))] + #[cfg_attr( + all(not(feature = "live"), not(feature = "prerecorded")), + allow(unused) + )] base_url: Url, client: reqwest::Client, } diff --git a/src/transcription/live.rs b/src/transcription/live.rs index 52b8fd89..3755052b 100644 --- a/src/transcription/live.rs +++ b/src/transcription/live.rs @@ -111,7 +111,6 @@ impl Transcription<'_> { } url } - } impl FileChunker { @@ -231,10 +230,10 @@ where } } - let mut source = self.source - .ok_or(DeepgramError::NoSource)? - .map(|res| res.map(|bytes| Message::binary(Vec::from(bytes.as_ref())))); - + let mut source = self + .source + .ok_or(DeepgramError::NoSource)? + .map(|res| res.map(|bytes| Message::binary(Vec::from(bytes.as_ref())))); let request = Request::builder() .method("GET") @@ -299,7 +298,7 @@ where } #[cfg(test)] -mod tests{ +mod tests { #[test] fn test_stream_url() { let dg = crate::Deepgram::new("token"); @@ -317,5 +316,4 @@ mod tests{ "ws://localhost:8080/v1/listen", ); } - -} \ No newline at end of file +} diff --git a/src/transcription/prerecorded.rs b/src/transcription/prerecorded.rs index 5844dbc0..ac0eebcc 100644 --- a/src/transcription/prerecorded.rs +++ b/src/transcription/prerecorded.rs @@ -269,7 +269,6 @@ impl Transcription<'_> { .query(&[("callback", callback)]) } - fn listen_url(&self) -> Url { self.0.base_url.join(DEEPGRAM_API_URL_LISTEN).unwrap() } @@ -282,13 +281,18 @@ mod tests { #[test] fn listen_url() { let dg = Deepgram::new("token"); - assert_eq!(&dg.transcription().listen_url().to_string(), "https://api.deepgram.com/v1/listen"); + assert_eq!( + &dg.transcription().listen_url().to_string(), + "https://api.deepgram.com/v1/listen" + ); } #[test] fn listen_url_custom_host() { let dg = Deepgram::with_base_url("token", "http://localhost:8888/abc/"); - assert_eq!(&dg.transcription().listen_url().to_string(), "http://localhost:8888/abc/v1/listen"); + assert_eq!( + &dg.transcription().listen_url().to_string(), + "http://localhost:8888/abc/v1/listen" + ); } - -} \ No newline at end of file +}