From 88959d24762f53d65525a6d4c413ee93a2346316 Mon Sep 17 00:00:00 2001 From: nicholaslyang Date: Thu, 13 Jul 2023 11:15:11 -0400 Subject: [PATCH] Added clippy deny all to force errors on running clippy --- crates/turborepo-api-client/src/lib.rs | 1 + crates/turborepo-cache/src/http.rs | 4 ++-- crates/turborepo-cache/src/lib.rs | 9 ++++++++- crates/turborepo-env/src/lib.rs | 2 ++ crates/turborepo-fs/src/lib.rs | 2 ++ crates/turborepo-globwalk/src/lib.rs | 1 + crates/turborepo-lib/src/lib.rs | 1 + crates/turborepo-lockfiles/src/lib.rs | 2 ++ crates/turborepo-paths/src/lib.rs | 1 + crates/turborepo-pidlock/src/lib.rs | 2 ++ crates/turborepo-scm/src/lib.rs | 1 + crates/turborepo-updater/src/lib.rs | 2 ++ crates/turborepo-vercel-api-mock/src/lib.rs | 2 ++ crates/turborepo/src/main.rs | 2 ++ 14 files changed, 29 insertions(+), 3 deletions(-) diff --git a/crates/turborepo-api-client/src/lib.rs b/crates/turborepo-api-client/src/lib.rs index bbceabac01c29..1bc8ef6804b67 100644 --- a/crates/turborepo-api-client/src/lib.rs +++ b/crates/turborepo-api-client/src/lib.rs @@ -1,6 +1,7 @@ #![feature(async_closure)] #![feature(provide_any)] #![feature(error_generic_member_access)] +#![deny(clippy::all)] use std::env; diff --git a/crates/turborepo-cache/src/http.rs b/crates/turborepo-cache/src/http.rs index 89a6f8d72500c..332a92f2a6178 100644 --- a/crates/turborepo-cache/src/http.rs +++ b/crates/turborepo-cache/src/http.rs @@ -129,7 +129,7 @@ impl HttpCache { let body = response.bytes().await.map_err(|e| { CacheError::ApiClientError( - turborepo_api_client::Error::ReqwestError(e), + Box::new(turborepo_api_client::Error::ReqwestError(e)), Backtrace::capture(), ) })?; @@ -143,7 +143,7 @@ impl HttpCache { } else { response.bytes().await.map_err(|e| { CacheError::ApiClientError( - turborepo_api_client::Error::ReqwestError(e), + Box::new(turborepo_api_client::Error::ReqwestError(e)), Backtrace::capture(), ) })? diff --git a/crates/turborepo-cache/src/lib.rs b/crates/turborepo-cache/src/lib.rs index 2d5b5d77b1c51..c02861bd7ac4f 100644 --- a/crates/turborepo-cache/src/lib.rs +++ b/crates/turborepo-cache/src/lib.rs @@ -1,5 +1,6 @@ #![feature(error_generic_member_access)] #![feature(provide_any)] +#![deny(clippy::all)] pub mod cache_archive; pub mod http; @@ -25,7 +26,7 @@ pub enum CacheError { #[error("cannot untar file to {0}")] InvalidFilePath(String, #[backtrace] Backtrace), #[error("artifact verification failed: {0}")] - ApiClientError(#[from] turborepo_api_client::Error, #[backtrace] Backtrace), + ApiClientError(Box, #[backtrace] Backtrace), #[error("signing artifact failed: {0}")] SignatureError(#[from] SignatureError, #[backtrace] Backtrace), #[error("invalid duration")] @@ -52,6 +53,12 @@ pub enum CacheError { LinkOutsideOfDirectory(String, #[backtrace] Backtrace), } +impl From for CacheError { + fn from(value: turborepo_api_client::Error) -> Self { + CacheError::ApiClientError(Box::new(value), Backtrace::capture()) + } +} + #[derive(Debug, Clone, PartialEq)] pub enum CacheSource { Local, diff --git a/crates/turborepo-env/src/lib.rs b/crates/turborepo-env/src/lib.rs index aa5a6c461a7d9..93cf08e3b4717 100644 --- a/crates/turborepo-env/src/lib.rs +++ b/crates/turborepo-env/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(clippy::all)] + use std::{ collections::HashMap, env, diff --git a/crates/turborepo-fs/src/lib.rs b/crates/turborepo-fs/src/lib.rs index 1cbfed057de84..5ef281c0c0cff 100644 --- a/crates/turborepo-fs/src/lib.rs +++ b/crates/turborepo-fs/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(clippy::all)] + use std::fs::{self, DirBuilder, Metadata}; use anyhow::Result; diff --git a/crates/turborepo-globwalk/src/lib.rs b/crates/turborepo-globwalk/src/lib.rs index 34dbe55d8d603..2410ec1060e7c 100644 --- a/crates/turborepo-globwalk/src/lib.rs +++ b/crates/turborepo-globwalk/src/lib.rs @@ -1,4 +1,5 @@ #![feature(assert_matches)] +#![deny(clippy::all)] mod empty_glob; diff --git a/crates/turborepo-lib/src/lib.rs b/crates/turborepo-lib/src/lib.rs index 2fa4036a357ed..f78680f2574fa 100644 --- a/crates/turborepo-lib/src/lib.rs +++ b/crates/turborepo-lib/src/lib.rs @@ -2,6 +2,7 @@ #![feature(box_patterns)] #![feature(error_generic_member_access)] #![feature(provide_any)] +#![deny(clippy::all)] mod child; mod cli; diff --git a/crates/turborepo-lockfiles/src/lib.rs b/crates/turborepo-lockfiles/src/lib.rs index bc6c53e089620..d2bb84a34dae0 100644 --- a/crates/turborepo-lockfiles/src/lib.rs +++ b/crates/turborepo-lockfiles/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(clippy::all)] + mod berry; mod error; mod npm; diff --git a/crates/turborepo-paths/src/lib.rs b/crates/turborepo-paths/src/lib.rs index 7ef609c82622f..d2e8e9e95161a 100644 --- a/crates/turborepo-paths/src/lib.rs +++ b/crates/turborepo-paths/src/lib.rs @@ -1,5 +1,6 @@ #![feature(assert_matches)] #![feature(fs_try_exists)] +#![deny(clippy::all)] /// Turborepo's path handling library /// Defines distinct path types for the different usecases of paths in turborepo diff --git a/crates/turborepo-pidlock/src/lib.rs b/crates/turborepo-pidlock/src/lib.rs index 86b007dc4dd2d..8ba2421c5ecb2 100644 --- a/crates/turborepo-pidlock/src/lib.rs +++ b/crates/turborepo-pidlock/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(clippy::all)] + use std::{ convert::TryInto, fs, diff --git a/crates/turborepo-scm/src/lib.rs b/crates/turborepo-scm/src/lib.rs index 3d1bbff00ba8d..ab03fefb6dfab 100644 --- a/crates/turborepo-scm/src/lib.rs +++ b/crates/turborepo-scm/src/lib.rs @@ -1,6 +1,7 @@ #![feature(error_generic_member_access)] #![feature(provide_any)] #![feature(assert_matches)] +#![deny(clippy::all)] use std::{ backtrace::{self, Backtrace}, diff --git a/crates/turborepo-updater/src/lib.rs b/crates/turborepo-updater/src/lib.rs index 0a1878ee5739a..489d2c0c02685 100644 --- a/crates/turborepo-updater/src/lib.rs +++ b/crates/turborepo-updater/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(clippy::all)] + use std::{fmt, time::Duration}; use console::style; diff --git a/crates/turborepo-vercel-api-mock/src/lib.rs b/crates/turborepo-vercel-api-mock/src/lib.rs index a859ff700eec2..69f086ff642c9 100644 --- a/crates/turborepo-vercel-api-mock/src/lib.rs +++ b/crates/turborepo-vercel-api-mock/src/lib.rs @@ -1,3 +1,5 @@ +#![deny(clippy::all)] + use std::{collections::HashMap, fs::OpenOptions, io::Write, net::SocketAddr, sync::Arc}; use anyhow::Result; diff --git a/crates/turborepo/src/main.rs b/crates/turborepo/src/main.rs index 676bb0baf2bbc..347240cdc3cc6 100644 --- a/crates/turborepo/src/main.rs +++ b/crates/turborepo/src/main.rs @@ -1,3 +1,5 @@ +#![deny(clippy::all)] + use std::{ env::{consts, current_exe}, process,