From 2b81b39ace83b199cda54d0e4da0a9b1bf1829d1 Mon Sep 17 00:00:00 2001 From: maciektr Date: Thu, 13 Jun 2024 17:02:15 +0200 Subject: [PATCH] Fix clippy errors after Rust update --- extensions/scarb-doc/src/types.rs | 3 +++ scarb/src/sources/git/client.rs | 12 +++++------- utils/test-for-each-example/src/lib.rs | 4 ++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/extensions/scarb-doc/src/types.rs b/extensions/scarb-doc/src/types.rs index 3b1bb5146..cbbb89ca3 100644 --- a/extensions/scarb-doc/src/types.rs +++ b/extensions/scarb-doc/src/types.rs @@ -1,3 +1,6 @@ +// TODO(drknzz): Remove if not needed. +#![allow(dead_code)] + use cairo_lang_defs::db::DefsGroup; use cairo_lang_defs::ids::{ ConstantId, EnumId, ExternFunctionId, ExternTypeId, FreeFunctionId, ImplAliasId, ImplDefId, diff --git a/scarb/src/sources/git/client.rs b/scarb/src/sources/git/client.rs index bba0f9f81..5c460e90e 100644 --- a/scarb/src/sources/git/client.rs +++ b/scarb/src/sources/git/client.rs @@ -61,8 +61,7 @@ impl fmt::Debug for GitDatabase { /// A local checkout of a particular Git commit. #[derive(Debug)] -pub struct GitCheckout<'d> { - pub db: &'d GitDatabase, +pub struct GitCheckout { pub location: Utf8PathBuf, pub rev: Rev, } @@ -202,7 +201,7 @@ impl GitDatabase { exec(&mut cmd, config) } - pub fn copy_to(&self, fs: &Filesystem, rev: Rev, config: &Config) -> Result> { + pub fn copy_to(&self, fs: &Filesystem, rev: Rev, config: &Config) -> Result { // If the checkout exists, the rev matches, and is marked ok, use it. // A non-ok checkout can happen if the checkout operation was // interrupted. In that case, the checkout gets deleted and a new @@ -219,7 +218,6 @@ impl GitDatabase { { debug!("git checkout ready; skipping clone; fs={fs}"); return Ok(GitCheckout { - db: self, location: fs.path_existent()?.to_path_buf(), rev, }); @@ -280,9 +278,9 @@ impl GitDatabase { } } -impl<'d> GitCheckout<'d> { +impl GitCheckout { #[tracing::instrument(level = "trace", skip(config))] - fn clone(db: &'d GitDatabase, fs: &Filesystem, rev: Rev, config: &Config) -> Result { + fn clone(db: &GitDatabase, fs: &Filesystem, rev: Rev, config: &Config) -> Result { unsafe { fs.recreate()?; } @@ -298,7 +296,7 @@ impl<'d> GitCheckout<'d> { cmd.arg(&location); exec(&mut cmd, config)?; - Ok(Self { db, location, rev }) + Ok(Self { location, rev }) } #[tracing::instrument(level = "trace", skip(config))] diff --git a/utils/test-for-each-example/src/lib.rs b/utils/test-for-each-example/src/lib.rs index 375c888f4..2d3f118f2 100644 --- a/utils/test-for-each-example/src/lib.rs +++ b/utils/test-for-each-example/src/lib.rs @@ -1,3 +1,7 @@ +// TODO(maciektr): Remove when `darling` gets fixed. +// See: https://github.com/TedDriggs/darling/pull/292 +#![allow(clippy::manual_unwrap_or_default)] + use proc_macro::TokenStream; use std::path::Path;