Skip to content

Commit c1aac65

Browse files
committed
chore(lints): fix lints and formatting
1 parent 9cbde95 commit c1aac65

File tree

5 files changed

+17
-23
lines changed

5 files changed

+17
-23
lines changed

src/client.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use url::Url;
3939
pub struct Client {
4040
base_url: Url,
4141
api_token: String,
42-
client: reqwest::Client,
42+
reqwest: reqwest::Client,
4343
}
4444

4545
impl Client {
@@ -48,7 +48,7 @@ impl Client {
4848
Client {
4949
base_url,
5050
api_token: api_token.into(),
51-
client: reqwest::Client::new(),
51+
reqwest: reqwest::Client::new(),
5252
}
5353
}
5454

@@ -94,8 +94,8 @@ impl Client {
9494
.map_err(ClientError::URLParseError)?;
9595

9696
let request = match endpoint.method() {
97-
reqwest::Method::GET => self.client.get(url),
98-
reqwest::Method::POST => self.client.post(url),
97+
reqwest::Method::GET => self.reqwest.get(url),
98+
reqwest::Method::POST => self.reqwest.post(url),
9999
_ => return Err(ClientError::InvalidRequestMethod),
100100
}
101101
.header("Authorization", format!("Bearer {}", self.api_token));
@@ -311,7 +311,7 @@ impl Client {
311311
/// }
312312
/// # })
313313
/// ```
314-
///
314+
///
315315
/// # Errors
316316
/// This function will return an error if the request fails or if the URL is invalid.
317317
pub async fn list_event_types(

src/client/client_request.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,9 @@ pub trait StreamingRequest: ClientRequest {
6767
fn lines_stream(
6868
response: reqwest::Response,
6969
) -> impl Stream<Item = Result<String, ClientError>> {
70-
let bytes = response.bytes_stream().map_err(|err| {
71-
io::Error::new(
72-
io::ErrorKind::Other,
73-
format!("Failed to read response stream: {err}"),
74-
)
75-
});
70+
let bytes = response
71+
.bytes_stream()
72+
.map_err(|err| io::Error::other(format!("Failed to read response stream: {err}")));
7673
let stream_reader = StreamReader::new(bytes);
7774
LinesStream::new(BufReader::new(stream_reader).lines()).map_err(ClientError::from)
7875
}

src/client/client_request/list_subjects.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ pub struct ListSubjectsRequest<'a> {
1212
pub base_subject: &'a str,
1313
}
1414

15-
impl<'a> ClientRequest for ListSubjectsRequest<'a> {
15+
impl ClientRequest for ListSubjectsRequest<'_> {
1616
const URL_PATH: &'static str = "/api/v1/read-subjects";
1717
const METHOD: Method = Method::POST;
1818

1919
fn body(&self) -> Option<Result<impl Serialize, ClientError>> {
2020
Some(Ok(self))
2121
}
2222
}
23-
impl<'a> StreamingRequest for ListSubjectsRequest<'a> {
23+
impl StreamingRequest for ListSubjectsRequest<'_> {
2424
type ItemType = String;
2525

2626
fn build_stream(

src/client/client_request/register_event_schema.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ impl<'a> RegisterEventSchemaRequest<'a> {
2323
}
2424
}
2525

26-
impl<'a> ClientRequest for RegisterEventSchemaRequest<'a> {
26+
impl ClientRequest for RegisterEventSchemaRequest<'_> {
2727
const URL_PATH: &'static str = "/api/v1/register-event-schema";
2828
const METHOD: Method = Method::POST;
2929

3030
fn body(&self) -> Option<Result<impl Serialize, ClientError>> {
3131
Some(Ok(self))
3232
}
3333
}
34-
impl<'a> OneShotRequest for RegisterEventSchemaRequest<'a> {
34+
impl OneShotRequest for RegisterEventSchemaRequest<'_> {
3535
type Response = ManagementEvent;
3636

3737
fn validate_response(&self, response: &Self::Response) -> Result<(), ClientError> {

src/container.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl ContainerBuilder {
114114
Ok(Container {
115115
internal_port: self.internal_port,
116116
api_token: self.api_token.clone(),
117-
container: GenericImage::new(self.image_name, self.image_tag)
117+
instance: GenericImage::new(self.image_name, self.image_tag)
118118
.with_exposed_port(self.internal_port)
119119
.with_wait_for(WaitFor::Http(Box::new(
120120
HttpWaitStrategy::new("/api/v1/ping")
@@ -152,7 +152,7 @@ impl ContainerBuilder {
152152
/// ```
153153
#[derive(Debug)]
154154
pub struct Container {
155-
container: ContainerAsync<GenericImage>,
155+
instance: ContainerAsync<GenericImage>,
156156
internal_port: ContainerPort,
157157
api_token: String,
158158
}
@@ -184,7 +184,7 @@ impl Container {
184184
/// # Errors
185185
/// This function will return an error if the container is not running (e.g. because it crashed) or if the host could not be retrieved
186186
pub async fn get_host(&self) -> Result<Host, ContainerError> {
187-
Ok(self.container.get_host().await?)
187+
Ok(self.instance.get_host().await?)
188188
}
189189

190190
/// Get the mapped port for the database.
@@ -194,10 +194,7 @@ impl Container {
194194
/// # Errors
195195
/// This function will return an error if the container is not running (e.g. because it crashed) or if the host could not be retrieved
196196
pub async fn get_mapped_port(&self) -> Result<u16, ContainerError> {
197-
Ok(self
198-
.container
199-
.get_host_port_ipv4(self.internal_port)
200-
.await?)
197+
Ok(self.instance.get_host_port_ipv4(self.internal_port).await?)
201198
}
202199

203200
/// Get the complete http base URL for the database.
@@ -227,7 +224,7 @@ impl Container {
227224
/// # Errors
228225
/// This function will return an error if the container could not be stopped.
229226
pub async fn stop(self) -> Result<(), ContainerError> {
230-
self.container.stop().await?;
227+
self.instance.stop().await?;
231228
Ok(())
232229
}
233230

0 commit comments

Comments
 (0)