Skip to content

Commit

Permalink
chore: fix rustc lint elided_named_lifetimes (#8796)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Sep 3, 2024
1 parent cb109b1 commit 143abd6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/common/src/ens.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! ENS Name resolving utilities.
#![allow(missing_docs, elided_named_lifetimes)]
#![allow(missing_docs)]

use self::EnsResolver::EnsResolverInstance;
use alloy_primitives::{address, Address, Keccak256, B256};
Expand Down
3 changes: 1 addition & 2 deletions crates/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
//!
//! Foundry configuration.
#![allow(elided_named_lifetimes)]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

Expand Down Expand Up @@ -1128,7 +1127,7 @@ impl Config {
pub fn get_rpc_url_or<'a>(
&'a self,
fallback: impl Into<Cow<'a, str>>,
) -> Result<Cow<'_, str>, UnresolvedEnvVarError> {
) -> Result<Cow<'a, str>, UnresolvedEnvVarError> {
if let Some(url) = self.get_rpc_url() {
url
} else {
Expand Down
4 changes: 1 addition & 3 deletions crates/doc/src/preprocessor/infer_hyperlinks.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(elided_named_lifetimes)]

use super::{Preprocessor, PreprocessorId};
use crate::{Comments, Document, ParseItem, ParseSource};
use forge_fmt::solang_ext::SafeUnwrap;
Expand Down Expand Up @@ -228,7 +226,7 @@ impl<'a> InlineLink<'a> {
})
}

fn captures(s: &'a str) -> impl Iterator<Item = Self> + '_ {
fn captures(s: &'a str) -> impl Iterator<Item = Self> + 'a {
RE_INLINE_LINK.captures(s).map(Self::from_capture).into_iter().flatten()
}

Expand Down
20 changes: 9 additions & 11 deletions crates/forge/src/multi_runner.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Forge test runner for multiple contracts.
#![allow(elided_named_lifetimes)]

use crate::{
progress::TestsProgress, result::SuiteResult, runner::LIBRARY_DEPLOYER, ContractRunner,
TestFilter, TestOptions,
Expand Down Expand Up @@ -86,28 +84,28 @@ pub struct MultiContractRunner {

impl MultiContractRunner {
/// Returns an iterator over all contracts that match the filter.
pub fn matching_contracts<'a>(
pub fn matching_contracts<'a: 'b, 'b>(
&'a self,
filter: &'a dyn TestFilter,
) -> impl Iterator<Item = (&ArtifactId, &TestContract)> {
filter: &'b dyn TestFilter,
) -> impl Iterator<Item = (&'a ArtifactId, &'a TestContract)> + 'b {
self.contracts.iter().filter(|&(id, c)| matches_contract(id, &c.abi, filter))
}

/// Returns an iterator over all test functions that match the filter.
pub fn matching_test_functions<'a>(
pub fn matching_test_functions<'a: 'b, 'b>(
&'a self,
filter: &'a dyn TestFilter,
) -> impl Iterator<Item = &Function> {
filter: &'b dyn TestFilter,
) -> impl Iterator<Item = &'a Function> + 'b {
self.matching_contracts(filter)
.flat_map(|(_, c)| c.abi.functions())
.filter(|func| is_matching_test(func, filter))
}

/// Returns an iterator over all test functions in contracts that match the filter.
pub fn all_test_functions<'a>(
pub fn all_test_functions<'a: 'b, 'b>(
&'a self,
filter: &'a dyn TestFilter,
) -> impl Iterator<Item = &Function> {
filter: &'b dyn TestFilter,
) -> impl Iterator<Item = &'a Function> + 'b {
self.contracts
.iter()
.filter(|(id, _)| filter.matches_path(&id.source) && filter.matches_contract(&id.name))
Expand Down

0 comments on commit 143abd6

Please sign in to comment.