这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,3 @@ wrap_comments = true

imports_granularity = "Crate"
group_imports = "StdExternalCrate"

# do not apply 2024 edition formatting
style_edition = "2021"
6 changes: 3 additions & 3 deletions crates/turbo-trace/src/tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ use oxc_resolver::{
EnforceExtension, ResolveError, ResolveOptions, Resolver, TsconfigOptions, TsconfigReferences,
};
use swc_common::{
FileName, SourceMap,
comments::SingleThreadedComments,
errors::{ColorConfig, Handler},
input::StringInput,
FileName, SourceMap,
};
use swc_ecma_ast::EsVersion;
use swc_ecma_parser::{lexer::Lexer, Capturing, EsSyntax, Parser, Syntax, TsSyntax};
use swc_ecma_parser::{Capturing, EsSyntax, Parser, Syntax, TsSyntax, lexer::Lexer};
use swc_ecma_visit::VisitWith;
use thiserror::Error;
use tokio::task::JoinSet;
Expand Down Expand Up @@ -424,7 +424,7 @@ impl Tracer {
source_map: self.source_map.clone(),
files: HashMap::new(),
errors: vec![TraceError::GlobError(Arc::new(e))],
}
};
}
};

Expand Down
6 changes: 3 additions & 3 deletions crates/turborepo-analytics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

use std::time::Duration;

use futures::{stream::FuturesUnordered, StreamExt};
use futures::{StreamExt, stream::FuturesUnordered};
use thiserror::Error;
use tokio::{
select,
sync::{mpsc, oneshot},
task::{JoinError, JoinHandle},
};
use tracing::debug;
use turborepo_api_client::{analytics::AnalyticsClient, APIAuth};
use turborepo_api_client::{APIAuth, analytics::AnalyticsClient};
pub use turborepo_vercel_api::AnalyticsEvent;
use uuid::Uuid;

Expand Down Expand Up @@ -188,7 +188,7 @@
select,
sync::{mpsc, mpsc::UnboundedReceiver},
};
use turborepo_api_client::{analytics::AnalyticsClient, APIAuth};
use turborepo_api_client::{APIAuth, analytics::AnalyticsClient};
use turborepo_vercel_api::{AnalyticsEvent, CacheEvent, CacheSource};
use uuid::Uuid;

Expand Down Expand Up @@ -446,7 +446,7 @@

#[derive(Clone)]
struct ErrorClient {
tx: mpsc::UnboundedSender<()>,

Check warning on line 449 in crates/turborepo-analytics/src/lib.rs

View workflow job for this annotation

GitHub Actions / Rust lints

field `tx` is never read

Check warning on line 449 in crates/turborepo-analytics/src/lib.rs

View workflow job for this annotation

GitHub Actions / Turborepo Rust testing on ubuntu

field `tx` is never read

Check warning on line 449 in crates/turborepo-analytics/src/lib.rs

View workflow job for this annotation

GitHub Actions / Turborepo Rust testing on windows

field `tx` is never read

Check warning on line 449 in crates/turborepo-analytics/src/lib.rs

View workflow job for this annotation

GitHub Actions / Turborepo Rust testing on macos

field `tx` is never read
}

impl AnalyticsClient for ErrorClient {
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-api-client/src/analytics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::future::Future;
use reqwest::Method;
pub use turborepo_vercel_api::{AnalyticsEvent, CacheEvent, CacheSource};

use crate::{retry, APIAuth, APIClient, Error};
use crate::{APIAuth, APIClient, Error, retry};

pub trait AnalyticsClient {
fn record_analytics(
Expand Down
14 changes: 7 additions & 7 deletions crates/turborepo-api-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ use regex::Regex;
pub use reqwest::Response;
use reqwest::{Body, Method, RequestBuilder, StatusCode};
use serde::Deserialize;
use turborepo_ci::{is_ci, Vendor};
use turborepo_ci::{Vendor, is_ci};
use turborepo_vercel_api::{
token::ResponseTokenMetadata, APIError, CachingStatus, CachingStatusResponse,
PreflightResponse, Team, TeamsResponse, UserResponse, VerificationResponse, VerifiedSsoUser,
APIError, CachingStatus, CachingStatusResponse, PreflightResponse, Team, TeamsResponse,
UserResponse, VerificationResponse, VerifiedSsoUser, token::ResponseTokenMetadata,
};
use url::Url;

Expand Down Expand Up @@ -228,7 +228,7 @@ impl Client for APIClient {
return Error::InvalidJson {
err,
text: body.clone(),
}
};
}
};

Expand All @@ -242,7 +242,7 @@ impl Client for APIClient {
return Error::UnknownCachingStatus(
status_string.to_string(),
Backtrace::capture(),
)
);
}
};

Expand Down Expand Up @@ -641,7 +641,7 @@ impl APIClient {
return Err(Error::InvalidUrl {
url: location.to_string(),
err: e,
})
});
}
}
} else {
Expand Down Expand Up @@ -787,7 +787,7 @@ mod test {
use turborepo_vercel_api_mock::start_test_server;
use url::Url;

use crate::{telemetry::TelemetryClient, APIClient, AnonAPIClient, CacheClient, Client};
use crate::{APIClient, AnonAPIClient, CacheClient, Client, telemetry::TelemetryClient};

#[tokio::test]
async fn test_do_preflight() -> Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-api-client/src/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ mod test {
use std::{assert_matches::assert_matches, time::Duration};

use crate::{
retry::{make_retryable_request, RetryStrategy},
Error,
retry::{RetryStrategy, make_retryable_request},
};

#[tokio::test]
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-api-client/src/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::future::Future;
use reqwest::Method;
use turborepo_vercel_api::telemetry::TelemetryEvent;

use crate::{retry, AnonAPIClient, Error};
use crate::{AnonAPIClient, Error, retry};

const TELEMETRY_ENDPOINT: &str = "/api/turborepo/v1/events";

Expand Down
14 changes: 7 additions & 7 deletions crates/turborepo-auth/src/auth/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use reqwest::Url;
use tokio::sync::OnceCell;
use tracing::{debug, warn};
use turborepo_api_client::{CacheClient, Client, TokenClient};
use turborepo_ui::{start_spinner, ColorConfig, BOLD};
use turborepo_ui::{BOLD, ColorConfig, start_spinner};

use crate::{auth::extract_vercel_token, error, ui, LoginOptions, Token};
use crate::{LoginOptions, Token, auth::extract_vercel_token, error, ui};

const DEFAULT_HOST_NAME: &str = "127.0.0.1";
const DEFAULT_PORT: u16 = 9789;
Expand Down Expand Up @@ -155,7 +155,7 @@ mod tests {
use turborepo_vercel_api_mock::start_test_server;

use super::*;
use crate::{login_server, LoginServer};
use crate::{LoginServer, login_server};

struct MockLoginServer {
hits: Arc<AtomicUsize>,
Expand Down Expand Up @@ -314,10 +314,10 @@ mod tests {
&self,
_hash: &str,
_artifact_body: impl turborepo_api_client::Stream<
Item = Result<turborepo_api_client::Bytes, turborepo_api_client::Error>,
> + Send
+ Sync
+ 'static,
Item = Result<turborepo_api_client::Bytes, turborepo_api_client::Error>,
> + Send
+ Sync
+ 'static,
_body_len: usize,
_duration: u64,
_tag: Option<&str>,
Expand Down
6 changes: 3 additions & 3 deletions crates/turborepo-auth/src/auth/logout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use tracing::error;
use turbopath::AbsoluteSystemPath;
use turborepo_api_client::TokenClient;
use turborepo_dirs::{config_dir, vercel_config_dir};
use turborepo_ui::{cprintln, GREY};
use turborepo_ui::{GREY, cprintln};

use crate::{
Error, LogoutOptions, Token, TURBO_TOKEN_DIR, TURBO_TOKEN_FILE, VERCEL_TOKEN_DIR,
Error, LogoutOptions, TURBO_TOKEN_DIR, TURBO_TOKEN_FILE, Token, VERCEL_TOKEN_DIR,
VERCEL_TOKEN_FILE,
};

Expand Down Expand Up @@ -88,7 +88,7 @@ mod tests {
use turborepo_api_client::Client;
use turborepo_ui::ColorConfig;
use turborepo_vercel_api::{
token::ResponseTokenMetadata, Team, TeamsResponse, UserResponse, VerifiedSsoUser,
Team, TeamsResponse, UserResponse, VerifiedSsoUser, token::ResponseTokenMetadata,
};
use url::Url;

Expand Down
16 changes: 8 additions & 8 deletions crates/turborepo-auth/src/auth/sso.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use reqwest::Url;
use tokio::sync::OnceCell;
use tracing::warn;
use turborepo_api_client::{CacheClient, Client, TokenClient};
use turborepo_ui::{start_spinner, ColorConfig, BOLD};
use turborepo_ui::{BOLD, ColorConfig, start_spinner};

use crate::{auth::extract_vercel_token, error, ui, Error, LoginOptions, Token};
use crate::{Error, LoginOptions, Token, auth::extract_vercel_token, error, ui};

const DEFAULT_HOST_NAME: &str = "127.0.0.1";
const DEFAULT_PORT: u16 = 9789;
Expand Down Expand Up @@ -149,14 +149,14 @@ mod tests {
use async_trait::async_trait;
use reqwest::{Method, RequestBuilder, Response};
use turborepo_vercel_api::{
token::{ResponseTokenMetadata, Scope},
CachingStatus, CachingStatusResponse, Membership, Role, Team, TeamsResponse, User,
UserResponse, VerifiedSsoUser,
token::{ResponseTokenMetadata, Scope},
};
use turborepo_vercel_api_mock::start_test_server;

use super::*;
use crate::{current_unix_time, LoginServer, LoginType};
use crate::{LoginServer, LoginType, current_unix_time};
const EXPECTED_VERIFICATION_TOKEN: &str = "expected_verification_token";

lazy_static::lazy_static! {
Expand Down Expand Up @@ -306,10 +306,10 @@ mod tests {
&self,
_hash: &str,
_artifact_body: impl turborepo_api_client::Stream<
Item = Result<turborepo_api_client::Bytes, turborepo_api_client::Error>,
> + Send
+ Sync
+ 'static,
Item = Result<turborepo_api_client::Bytes, turborepo_api_client::Error>,
> + Send
+ Sync
+ 'static,
_body_len: usize,
_duration: u64,
_tag: Option<&str>,
Expand Down
14 changes: 7 additions & 7 deletions crates/turborepo-auth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub use login_server::*;
use serde::Deserialize;
use turbopath::AbsoluteSystemPath;
use turborepo_api_client::{CacheClient, Client, TokenClient};
use turborepo_vercel_api::{token::ResponseTokenMetadata, User};
use turborepo_vercel_api::{User, token::ResponseTokenMetadata};

pub struct TeamInfo<'a> {
pub id: &'a str,
Expand Down Expand Up @@ -314,8 +314,8 @@ mod tests {
use tempfile::tempdir;
use turbopath::AbsoluteSystemPathBuf;
use turborepo_vercel_api::{
token::Scope, CachingStatus, CachingStatusResponse, Team, TeamsResponse, User,
UserResponse, VerifiedSsoUser,
CachingStatus, CachingStatusResponse, Team, TeamsResponse, User, UserResponse,
VerifiedSsoUser, token::Scope,
};
use url::Url;

Expand Down Expand Up @@ -537,10 +537,10 @@ mod tests {
&self,
_hash: &str,
_artifact_body: impl turborepo_api_client::Stream<
Item = Result<turborepo_api_client::Bytes, turborepo_api_client::Error>,
> + Send
+ Sync
+ 'static,
Item = Result<turborepo_api_client::Bytes, turborepo_api_client::Error>,
> + Send
+ Sync
+ 'static,
_body_len: usize,
_duration: u64,
_tag: Option<&str>,
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-auth/src/login_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{net::SocketAddr, sync::Arc};

use anyhow::Result;
use async_trait::async_trait;
use axum::{extract::Query, response::Redirect, routing::get, Router};
use axum::{Router, extract::Query, response::Redirect, routing::get};
use serde::Deserialize;
use tokio::sync::OnceCell;
use url::Url;
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-auth/src/ui/messages.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use turborepo_ui::{ColorConfig, BOLD, CYAN};
use turborepo_ui::{BOLD, CYAN, ColorConfig};

pub fn print_cli_authorized(user: &str, color_config: &ColorConfig) {
println!(
Expand Down
12 changes: 6 additions & 6 deletions crates/turborepo-cache/src/async_cache.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use std::sync::{atomic::AtomicU8, Arc, Mutex};
use std::sync::{Arc, Mutex, atomic::AtomicU8};

use futures::{stream::FuturesUnordered, StreamExt};
use tokio::sync::{mpsc, oneshot, Semaphore};
use tracing::{warn, Instrument, Level};
use futures::{StreamExt, stream::FuturesUnordered};
use tokio::sync::{Semaphore, mpsc, oneshot};
use tracing::{Instrument, Level, warn};
use turbopath::{AbsoluteSystemPath, AbsoluteSystemPathBuf, AnchoredSystemPathBuf};
use turborepo_analytics::AnalyticsSender;
use turborepo_api_client::{APIAuth, APIClient};

use crate::{
http::UploadMap, multiplexer::CacheMultiplexer, CacheError, CacheHitMetadata, CacheOpts,
CacheError, CacheHitMetadata, CacheOpts, http::UploadMap, multiplexer::CacheMultiplexer,
};

const WARNING_CUTOFF: u8 = 4;
Expand Down Expand Up @@ -226,9 +226,9 @@ mod tests {
use turborepo_vercel_api_mock::start_test_server;

use crate::{
test_cases::{get_test_cases, TestCase},
AsyncCache, CacheActions, CacheConfig, CacheHitMetadata, CacheOpts, CacheSource,
RemoteCacheOpts,
test_cases::{TestCase, get_test_cases},
};

#[tokio::test]
Expand Down
6 changes: 3 additions & 3 deletions crates/turborepo-cache/src/cache_archive/restore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ use tar::Entry;
use turbopath::{AbsoluteSystemPath, AbsoluteSystemPathBuf, AnchoredSystemPathBuf};

use crate::{
CacheError,
cache_archive::{
restore_directory::{restore_directory, CachedDirTree},
restore_directory::{CachedDirTree, restore_directory},
restore_regular::restore_regular,
restore_symlink::{
canonicalize_linkname, restore_symlink, restore_symlink_allow_missing_target,
},
},
CacheError,
};

pub struct CacheReader<'a> {
Expand Down Expand Up @@ -185,7 +185,7 @@ mod tests {

use anyhow::Result;
use tar::Header;
use tempfile::{tempdir, TempDir};
use tempfile::{TempDir, tempdir};
use test_case::test_case;
use tracing::debug;
use turbopath::{AbsoluteSystemPath, AbsoluteSystemPathBuf, AnchoredSystemPathBuf};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{fs::OpenOptions, io, io::Read, path::Path};
use tar::Entry;
use turbopath::{AbsoluteSystemPath, AnchoredSystemPath, AnchoredSystemPathBuf};

use crate::{cache_archive::restore_directory::CachedDirTree, CacheError};
use crate::{CacheError, cache_archive::restore_directory::CachedDirTree};

pub fn restore_regular(
dir_cache: &mut CachedDirTree,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use turbopath::{
PathError, UnknownPathType,
};

use crate::{cache_archive::restore_directory::CachedDirTree, CacheError};
use crate::{CacheError, cache_archive::restore_directory::CachedDirTree};

pub fn restore_symlink(
dir_cache: &mut CachedDirTree,
Expand Down
4 changes: 2 additions & 2 deletions crates/turborepo-cache/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl FromStr for CacheConfig {
text: s.to_string(),
s: ty.to_string(),
span: Some(SourceSpan::new(idx.into(), ty.len())),
})
});
}
}

Expand Down Expand Up @@ -190,7 +190,7 @@ impl FromStr for CacheActions {
c,
text: String::new(),
span: None,
})
});
}
}
}
Expand Down
Loading
Loading