Skip to content

Commit 7420062

Browse files
committed
fix: elided lifetime has a name clippy warnings
1 parent 0761898 commit 7420062

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

mithril-common/src/chain_observer/cli_observer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl CardanoCliRunner {
165165
command
166166
}
167167

168-
fn post_config_command<'a>(&'a self, command: &'a mut Command) -> &mut Command {
168+
fn post_config_command<'a>(&'a self, command: &'a mut Command) -> &'a mut Command {
169169
match self.network {
170170
CardanoNetwork::MainNet => command.arg("--mainnet"),
171171
CardanoNetwork::DevNet(magic) => command.args(vec![
@@ -331,7 +331,7 @@ impl CardanoCliChainObserver {
331331

332332
// This is the only way I found to tell the compiler the correct types
333333
// and lifetimes for the function `double`.
334-
fn parse_string<'a>(&'a self, string: &'a str) -> IResult<&str, f64> {
334+
fn parse_string<'a>(&'a self, string: &'a str) -> IResult<&'a str, f64> {
335335
nom::number::complete::double(string)
336336
}
337337

mithril-common/src/test_utils/apispec.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,28 @@ impl<'a> APISpec<'a> {
6767
}
6868

6969
/// Sets the path to specify/check.
70-
pub fn path(&'a mut self, path: &'a str) -> &mut APISpec {
70+
pub fn path(&'a mut self, path: &'a str) -> &'a mut APISpec<'a> {
7171
self.path = Some(path);
7272
self
7373
}
7474

7575
/// Sets the method to specify/check.
76-
pub fn method(&'a mut self, method: &'a str) -> &mut APISpec {
76+
pub fn method(&'a mut self, method: &'a str) -> &'a mut APISpec<'a> {
7777
self.method = Some(method);
7878
self
7979
}
8080

8181
/// Sets the content type to specify/check, note that it defaults to "application/json".
82-
pub fn content_type(&'a mut self, content_type: &'a str) -> &mut APISpec {
82+
pub fn content_type(&'a mut self, content_type: &'a str) -> &'a mut APISpec<'a> {
8383
self.content_type = Some(content_type);
8484
self
8585
}
8686

8787
/// Validates if a request is valid
88-
fn validate_request(&'a self, request_body: &impl Serialize) -> Result<&APISpec, String> {
88+
fn validate_request(
89+
&'a self,
90+
request_body: &impl Serialize,
91+
) -> Result<&'a APISpec<'a>, String> {
8992
let path = self.path.unwrap();
9093
let method = self.method.unwrap().to_lowercase();
9194
let content_type = self.content_type.unwrap();
@@ -104,7 +107,7 @@ impl<'a> APISpec<'a> {
104107
&'a self,
105108
path: &str,
106109
operation_object: &Value,
107-
) -> Result<&APISpec, String> {
110+
) -> Result<&'a APISpec<'a>, String> {
108111
let fake_base_url = "http://0.0.0.1";
109112
let url = Url::parse(&format!("{}{}", fake_base_url, path)).unwrap();
110113

@@ -130,7 +133,7 @@ impl<'a> APISpec<'a> {
130133
&'a self,
131134
response: &Response<Bytes>,
132135
expected_status_code: &StatusCode,
133-
) -> Result<&APISpec, String> {
136+
) -> Result<&'a APISpec<'a>, String> {
134137
if expected_status_code.as_u16() != response.status().as_u16() {
135138
return Err(format!(
136139
"expected status code {} but was {}",
@@ -143,7 +146,7 @@ impl<'a> APISpec<'a> {
143146
}
144147

145148
/// Validates if a response is valid
146-
fn validate_response(&'a self, response: &Response<Bytes>) -> Result<&APISpec, String> {
149+
fn validate_response(&'a self, response: &Response<Bytes>) -> Result<&'a APISpec<'a>, String> {
147150
let body = response.body();
148151
let status = response.status();
149152

@@ -207,7 +210,11 @@ impl<'a> APISpec<'a> {
207210
}
208211

209212
/// Validates conformity of a value against a schema
210-
fn validate_conformity(&'a self, value: &Value, schema: &Value) -> Result<&APISpec, String> {
213+
fn validate_conformity(
214+
&'a self,
215+
value: &Value,
216+
schema: &Value,
217+
) -> Result<&'a APISpec<'a>, String> {
211218
match schema {
212219
Null => match value {
213220
Null => Ok(self),

0 commit comments

Comments
 (0)