diff --git a/extensions/scarb-doc/src/docs_generation/markdown/traits.rs b/extensions/scarb-doc/src/docs_generation/markdown/traits.rs index 7e153edef..2ffa937e4 100644 --- a/extensions/scarb-doc/src/docs_generation/markdown/traits.rs +++ b/extensions/scarb-doc/src/docs_generation/markdown/traits.rs @@ -212,7 +212,7 @@ impl MarkdownDocItem for Trait { /// cthat share the same name. pub fn mark_duplicated_item_with_relative_path<'a, T: TopLevelMarkdownDocItem + 'a>( items: &'a [&'a T], -) -> Vec<(&&'a T, Option)> { +) -> Vec<(&'a &'a T, Option)> { let mut paths_for_item_name = HashMap::>::new(); for item in items { paths_for_item_name diff --git a/scarb/src/core/checksum.rs b/scarb/src/core/checksum.rs index 84aefbfe7..77315c978 100644 --- a/scarb/src/core/checksum.rs +++ b/scarb/src/core/checksum.rs @@ -65,7 +65,7 @@ impl FromStr for Checksum { } } -impl<'a> TryFrom<&'a str> for Checksum { +impl TryFrom<&str> for Checksum { type Error = anyhow::Error; fn try_from(s: &str) -> Result { diff --git a/scarb/src/core/config.rs b/scarb/src/core/config.rs index 452defe44..05b3bd25b 100644 --- a/scarb/src/core/config.rs +++ b/scarb/src/core/config.rs @@ -182,7 +182,7 @@ impl Config { self.creation_time.elapsed() } - pub fn package_cache_lock<'a>(&'a self) -> &AdvisoryLock<'a> { + pub fn package_cache_lock<'a>(&'a self) -> &'a AdvisoryLock<'a> { // UNSAFE: These mem::transmute calls only change generic lifetime parameters. let static_al: &AdvisoryLock<'static> = self.package_cache_lock.get_or_init(|| { let not_static_al = diff --git a/scarb/src/core/registry/cache.rs b/scarb/src/core/registry/cache.rs index 5ca9a8c91..7990be568 100644 --- a/scarb/src/core/registry/cache.rs +++ b/scarb/src/core/registry/cache.rs @@ -30,7 +30,7 @@ impl<'a> RegistryCache<'a> { } #[async_trait(?Send)] -impl<'c> Registry for RegistryCache<'c> { +impl Registry for RegistryCache<'_> { /// Attempt to find the packages that match dependency request. async fn query(&self, dependency: &ManifestDependency) -> Result> { self.queries.load(dependency.clone()).await diff --git a/scarb/src/core/registry/client/http.rs b/scarb/src/core/registry/client/http.rs index 7478123e4..abb471fa0 100644 --- a/scarb/src/core/registry/client/http.rs +++ b/scarb/src/core/registry/client/http.rs @@ -57,7 +57,7 @@ impl<'c> HttpRegistryClient<'c> { } #[async_trait] -impl<'c> RegistryClient for HttpRegistryClient<'c> { +impl RegistryClient for HttpRegistryClient<'_> { async fn get_records( &self, package: PackageName, diff --git a/scarb/src/core/registry/patcher.rs b/scarb/src/core/registry/patcher.rs index 07e706dab..b638512f7 100644 --- a/scarb/src/core/registry/patcher.rs +++ b/scarb/src/core/registry/patcher.rs @@ -22,7 +22,7 @@ impl<'a> RegistryPatcher<'a> { } #[async_trait(?Send)] -impl<'a> Registry for RegistryPatcher<'a> { +impl Registry for RegistryPatcher<'_> { #[tracing::instrument(skip_all)] async fn query(&self, dependency: &ManifestDependency) -> Result> { let patch = self.patch_map.lookup(dependency); diff --git a/scarb/src/core/registry/source_map.rs b/scarb/src/core/registry/source_map.rs index d9b5b250e..59ef1f395 100644 --- a/scarb/src/core/registry/source_map.rs +++ b/scarb/src/core/registry/source_map.rs @@ -57,7 +57,7 @@ impl<'c> SourceMap<'c> { } #[async_trait(?Send)] -impl<'c> Registry for SourceMap<'c> { +impl Registry for SourceMap<'_> { /// Attempt to find the packages that match a dependency request. async fn query(&self, dependency: &ManifestDependency) -> Result> { let source = self.ensure_loaded(dependency.source_id).await?; diff --git a/scarb/src/core/workspace.rs b/scarb/src/core/workspace.rs index e3414d639..e9490e04b 100644 --- a/scarb/src/core/workspace.rs +++ b/scarb/src/core/workspace.rs @@ -221,7 +221,7 @@ fn check_unique_targets(targets: &Vec<&Target>) -> Result<()> { Ok(()) } -impl<'c> fmt::Display for Workspace<'c> { +impl fmt::Display for Workspace<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let manifest_path = self.manifest_path(); let path = if manifest_path.file_name() == Some(MANIFEST_FILE_NAME) { @@ -233,7 +233,7 @@ impl<'c> fmt::Display for Workspace<'c> { } } -impl<'c> fmt::Debug for Workspace<'c> { +impl fmt::Debug for Workspace<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Workspace") .field("members", &self.members) @@ -251,7 +251,7 @@ impl Utf8PathWorkspaceExt for Utf8Path { } } -impl<'c> PackagesSource for Workspace<'c> { +impl PackagesSource for Workspace<'_> { type Package = Package; fn package_name_of(package: &Self::Package) -> &str { diff --git a/scarb/src/internal/to_version.rs b/scarb/src/internal/to_version.rs index 1a1c023da..34ef7aac4 100644 --- a/scarb/src/internal/to_version.rs +++ b/scarb/src/internal/to_version.rs @@ -11,20 +11,20 @@ impl ToVersion for Version { } } -impl<'a> ToVersion for &'a str { +impl ToVersion for &str { fn to_version(self) -> Result { Version::parse(self.trim()) .map_err(|_| anyhow::format_err!("cannot parse '{}' as a semver", self)) } } -impl<'a> ToVersion for &'a String { +impl ToVersion for &String { fn to_version(self) -> Result { (**self).to_version() } } -impl<'a> ToVersion for &'a Version { +impl ToVersion for &Version { fn to_version(self) -> Result { Ok(self.clone()) } diff --git a/scarb/src/ops/fmt.rs b/scarb/src/ops/fmt.rs index 343614905..cc2f9c049 100644 --- a/scarb/src/ops/fmt.rs +++ b/scarb/src/ops/fmt.rs @@ -297,7 +297,7 @@ fn format_file_in_place( } } -impl<'t> ParallelVisitor for PathFormatter<'t> { +impl ParallelVisitor for PathFormatter<'_> { fn visit(&mut self, dir_entry_res: Result) -> WalkState { let dir_entry = if let Ok(dir_entry) = dir_entry_res { dir_entry diff --git a/scarb/src/process.rs b/scarb/src/process.rs index f90ab1237..972f7150f 100644 --- a/scarb/src/process.rs +++ b/scarb/src/process.rs @@ -175,7 +175,7 @@ fn shlex_join(cmd: &Command) -> String { struct ShlexJoin<'a>(&'a Command); -impl<'a> fmt::Display for ShlexJoin<'a> { +impl fmt::Display for ShlexJoin<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn write_quoted(f: &mut fmt::Formatter<'_>, s: &OsStr) -> fmt::Result { let utf = s.to_string_lossy(); diff --git a/scarb/src/sources/git/mod.rs b/scarb/src/sources/git/mod.rs index a2183702e..78b3d54ea 100644 --- a/scarb/src/sources/git/mod.rs +++ b/scarb/src/sources/git/mod.rs @@ -150,7 +150,7 @@ impl<'c> GitSource<'c> { } #[async_trait] -impl<'c> Source for GitSource<'c> { +impl Source for GitSource<'_> { async fn query(&self, dependency: &ManifestDependency) -> Result> { self.ensure_loaded() .await? @@ -164,7 +164,7 @@ impl<'c> Source for GitSource<'c> { } } -impl<'c> fmt::Debug for GitSource<'c> { +impl fmt::Debug for GitSource<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("GitSource") .field("source", &self.source_id.to_string()) diff --git a/scarb/src/sources/path.rs b/scarb/src/sources/path.rs index f4186c894..fa1fd937b 100644 --- a/scarb/src/sources/path.rs +++ b/scarb/src/sources/path.rs @@ -91,7 +91,7 @@ impl<'c> PathSource<'c> { } #[async_trait] -impl<'c> Source for PathSource<'c> { +impl Source for PathSource<'_> { #[tracing::instrument(level = "trace", skip(self))] async fn query(&self, dependency: &ManifestDependency) -> Result> { Ok(self @@ -114,7 +114,7 @@ impl<'c> Source for PathSource<'c> { } } -impl<'c> fmt::Debug for PathSource<'c> { +impl fmt::Debug for PathSource<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("PathSource") .field("source", &self.source_id.to_string()) diff --git a/scarb/src/sources/registry.rs b/scarb/src/sources/registry.rs index a872d138c..d19376f9f 100644 --- a/scarb/src/sources/registry.rs +++ b/scarb/src/sources/registry.rs @@ -68,7 +68,7 @@ impl<'c> RegistrySource<'c> { } #[async_trait] -impl<'c> Source for RegistrySource<'c> { +impl Source for RegistrySource<'_> { #[tracing::instrument(level = "trace", skip(self))] async fn query(&self, dependency: &ManifestDependency) -> Result> { let records = self @@ -159,7 +159,7 @@ impl<'c> RegistrySource<'c> { } } -impl<'c> fmt::Debug for RegistrySource<'c> { +impl fmt::Debug for RegistrySource<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("RegistrySource") .field("source", &self.source_id.to_string()) diff --git a/scarb/src/sources/standard_lib.rs b/scarb/src/sources/standard_lib.rs index 697295f90..1c6025928 100644 --- a/scarb/src/sources/standard_lib.rs +++ b/scarb/src/sources/standard_lib.rs @@ -76,7 +76,7 @@ impl<'c> StandardLibSource<'c> { } #[async_trait] -impl<'c> Source for StandardLibSource<'c> { +impl Source for StandardLibSource<'_> { #[tracing::instrument(level = "trace", skip(self))] async fn query(&self, dependency: &ManifestDependency) -> Result> { self.ensure_loaded().await?.query(dependency).await @@ -88,7 +88,7 @@ impl<'c> Source for StandardLibSource<'c> { } } -impl<'c> fmt::Debug for StandardLibSource<'c> { +impl fmt::Debug for StandardLibSource<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("StandardLibSource").finish_non_exhaustive() } diff --git a/utils/scarb-test-support/src/project_builder.rs b/utils/scarb-test-support/src/project_builder.rs index d62d7bdbd..2ca0dbee5 100644 --- a/utils/scarb-test-support/src/project_builder.rs +++ b/utils/scarb-test-support/src/project_builder.rs @@ -251,7 +251,7 @@ pub struct DepWith<'a, T: DepBuilder + ?Sized> { value: Value, } -impl<'a, T: DepBuilder + ?Sized> DepBuilder for DepWith<'a, T> { +impl DepBuilder for DepWith<'_, T> { fn build(&self) -> Value { let mut table = self.dep.build(); table diff --git a/utils/scarb-ui/src/args/packages_filter.rs b/utils/scarb-ui/src/args/packages_filter.rs index 4deaf6b51..3998f899b 100644 --- a/utils/scarb-ui/src/args/packages_filter.rs +++ b/utils/scarb-ui/src/args/packages_filter.rs @@ -285,7 +285,7 @@ impl<'a> Spec<'a> { } } -impl<'a> fmt::Display for Spec<'a> { +impl fmt::Display for Spec<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Spec::All => write!(f, "*"), diff --git a/utils/scarb-ui/src/components/status.rs b/utils/scarb-ui/src/components/status.rs index ca245b247..2b257812a 100644 --- a/utils/scarb-ui/src/components/status.rs +++ b/utils/scarb-ui/src/components/status.rs @@ -35,7 +35,7 @@ impl<'a> Status<'a> { } } -impl<'a> Message for Status<'a> { +impl Message for Status<'_> { fn text(self) -> String { format!( "{} {}", diff --git a/utils/scarb-ui/src/components/typed.rs b/utils/scarb-ui/src/components/typed.rs index 5c7caeada..3cbf00837 100644 --- a/utils/scarb-ui/src/components/typed.rs +++ b/utils/scarb-ui/src/components/typed.rs @@ -64,7 +64,7 @@ impl<'a> TypedMessage<'a> { } } -impl<'a> Message for TypedMessage<'a> { +impl Message for TypedMessage<'_> { fn text(self) -> String { if self.skip_type_for_text { self.message.to_string() diff --git a/utils/scarb-ui/src/components/value.rs b/utils/scarb-ui/src/components/value.rs index 542efd5c6..7e3ae51be 100644 --- a/utils/scarb-ui/src/components/value.rs +++ b/utils/scarb-ui/src/components/value.rs @@ -25,7 +25,7 @@ impl<'a, T> ValueMessage<'a, T> { } } -impl<'a, T> Message for ValueMessage<'a, T> +impl Message for ValueMessage<'_, T> where T: Display + Serialize, {