Skip to content

Commit

Permalink
chore: run imports formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelOnFira committed May 6, 2024
1 parent b9c9991 commit ca8a61e
Show file tree
Hide file tree
Showing 155 changed files with 325 additions and 296 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::{Context, Result};
use std::{convert::Infallible, env, net::SocketAddr, process::Command};

use anyhow::{Context, Result};
use tokio::{
io::{AsyncBufReadExt, AsyncWriteExt},
net::{TcpListener, UdpSocket},
Expand Down Expand Up @@ -107,8 +108,10 @@ async fn with_select_term(future: impl std::future::Future<Output = Result<()>>)
}

async fn echo_http_server(port: u16) -> Result<()> {
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Request, Response, Server};
use hyper::{
service::{make_service_fn, service_fn},
Body, Request, Response, Server,
};

let addr = SocketAddr::from(([0, 0, 0, 0], port));
println!("HTTP: {}", port);
Expand Down
2 changes: 1 addition & 1 deletion lib/api-helper/build/src/macro_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl __RouterConfig {
};

match self.path_segments.last() {
Some(segment) if segment == prefix => {
Some(segment) if segment == prefix => {
self.path_segments.pop();
true
}
Expand Down
3 changes: 2 additions & 1 deletion lib/api-helper/build/src/start.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use std::{convert::Infallible, future::Future, net::SocketAddr, sync::Arc, time::Instant};

use hyper::{
body::HttpBody,
server::conn::AddrStream,
service::{make_service_fn, service_fn},
Body, Request, Response, Server,
};
use std::{convert::Infallible, future::Future, net::SocketAddr, sync::Arc, time::Instant};
use tracing::Instrument;
use uuid::Uuid;

Expand Down
2 changes: 1 addition & 1 deletion lib/api-helper/build/src/util.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use regex::Regex;
use std::{str::FromStr, time::Duration};

use global_error::prelude::*;
Expand All @@ -10,6 +9,7 @@ use hyper::{
header::{self, HeaderName},
Body, Request,
};
use regex::Regex;
use rivet_claims::ClaimsDecode;

/// Origins that the hub may be requesting from.
Expand Down
12 changes: 6 additions & 6 deletions lib/api-helper/build/tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

use std::sync::Once;

use chirp_worker::prelude::*;
use http::{header, method::Method};
use hyper::{Body, Request, Response};
use uuid::Uuid;

use ::api_helper::{
auth::ApiAuth,
error::handle_rejection,
macro_util, routes,
util::{verify_cors, CorsConfigBuilder, CorsResponse},
};
use chirp_worker::prelude::*;
use http::{header, method::Method};
use hyper::{Body, Request, Response};
use uuid::Uuid;

// Simulated ctx auth
pub struct Auth {
Expand Down Expand Up @@ -397,11 +396,12 @@ async fn route(

// Test endpoint module
mod test_endpoint {
use super::Auth;
use ::api_helper::{anchor::WatchIndexQuery, ctx::Ctx};
use chirp_worker::prelude::*;
use serde::{Deserialize, Serialize};

use super::Auth;

#[derive(Debug, Serialize, Deserialize)]
pub struct TestResponse {}

Expand Down
3 changes: 1 addition & 2 deletions lib/bolt/cli/src/commands/config.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use anyhow::*;
use bolt_core::dep;
use bolt_core::{
context::{self, ProjectContextData, RunContext},
tasks,
dep, tasks,
};
use clap::Parser;
use rivet_term::console::style;
Expand Down
3 changes: 1 addition & 2 deletions lib/bolt/cli/src/commands/secret.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use anyhow::*;
use bolt_core::context::ProjectContext;
use bolt_core::tasks::config::ConfigGenerator;
use bolt_core::{context::ProjectContext, tasks::config::ConfigGenerator};
use clap::{Parser, ValueEnum};
use serde_json::json;

Expand Down
3 changes: 1 addition & 2 deletions lib/bolt/cli/src/commands/ssh.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use anyhow::*;
use clap::{Parser, ValueEnum};

use bolt_core::{context::ProjectContext, tasks::ssh::TempSshKey};
use clap::{Parser, ValueEnum};

#[derive(ValueEnum, Clone)]
pub enum Format {
Expand Down
3 changes: 2 additions & 1 deletion lib/bolt/config/src/cache.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use serde::{Deserialize, Serialize};
use std::{
collections::{HashMap, HashSet},
time::SystemTime,
};

use serde::{Deserialize, Serialize};

/// Cached data used to speed up Bolt commands.
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
pub struct Cache {
Expand Down
3 changes: 2 additions & 1 deletion lib/bolt/config/src/ns.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, path::PathBuf};

use serde::{Deserialize, Serialize};
use uuid::Uuid;

pub fn decode(s: &str) -> Result<Namespace, toml::de::Error> {
Expand Down
3 changes: 2 additions & 1 deletion lib/bolt/config/src/project.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use serde::Deserialize;
use std::{collections::HashMap, path::PathBuf};

use serde::Deserialize;

pub fn decode(s: &str) -> Result<Project, toml::de::Error> {
toml::from_str(s)
}
Expand Down
3 changes: 2 additions & 1 deletion lib/bolt/config/src/service.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

use serde::{Deserialize, Serialize};

pub fn decode(s: &str) -> Result<ServiceConfig, toml::de::Error> {
toml::from_str(s)
}
Expand Down
3 changes: 1 addition & 2 deletions lib/bolt/core/src/context/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ use anyhow::*;
use sha2::{Digest, Sha256};
use tokio::{fs, sync::Mutex};

use crate::{config, context, utils::command_helper::CommandHelper};

use super::{RunContext, ServiceContext};
use crate::{config, context, utils::command_helper::CommandHelper};

pub type ProjectContext = Arc<ProjectContextData>;

Expand Down
10 changes: 5 additions & 5 deletions lib/bolt/core/src/context/service.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
use anyhow::{ensure, Context, Result};
use async_recursion::async_recursion;
use indexmap::IndexMap;
use std::{
collections::HashMap,
hash::{Hash, Hasher},
net::Ipv4Addr,
path::{Path, PathBuf},
sync::{Arc, Weak},
};

use anyhow::{ensure, Context, Result};
use async_recursion::async_recursion;
use indexmap::IndexMap;
use tokio::{fs, process::Command, sync::RwLock};

use super::BuildOptimization;
use crate::{
config::{
self,
Expand All @@ -20,8 +22,6 @@ use crate::{
utils,
};

use super::BuildOptimization;

pub type ServiceContext = Arc<ServiceContextData>;

pub struct ServiceContextData {
Expand Down
4 changes: 2 additions & 2 deletions lib/bolt/core/src/dep/cargo/cli.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use anyhow::{ensure, Context, Result};
use std::path::{Path, PathBuf};

use anyhow::{ensure, Context, Result};
use indoc::formatdoc;
use regex::Regex;
use serde_json::json;
use std::path::{Path, PathBuf};
use tokio::{fs, io::AsyncReadExt, process::Command, task::block_in_place};

use crate::{config, context::ProjectContext};
Expand Down
3 changes: 2 additions & 1 deletion lib/bolt/core/src/dep/terraform/cli.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{path::Path, process::Command, sync::Arc};

use anyhow::Result;
use lazy_static::lazy_static;
use std::{path::Path, process::Command, sync::Arc};
use tokio::sync::Semaphore;

use crate::{config, context::ProjectContext, utils, utils::command_helper::CommandHelper};
Expand Down
3 changes: 2 additions & 1 deletion lib/bolt/core/src/dep/terraform/gen.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::collections::HashMap;

use anyhow::{Context, Result};
use indoc::{formatdoc, indoc};
use serde_json::json;
use std::collections::HashMap;
use tokio::fs;

use crate::{
Expand Down
3 changes: 2 additions & 1 deletion lib/bolt/core/src/dep/terraform/output.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use serde::Deserialize;
use std::{collections::HashMap, ops::Deref};

use serde::Deserialize;

use crate::{config, context::ProjectContext};

#[derive(Debug, Clone, Deserialize)]
Expand Down
3 changes: 2 additions & 1 deletion lib/bolt/core/src/dep/terraform/remote_states.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::collections::HashMap;

use derive_builder::Builder;
use maplit::hashmap;
use std::collections::HashMap;

use crate::context::ProjectContext;

Expand Down
3 changes: 1 addition & 2 deletions lib/bolt/core/src/tasks/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use rivet_term::console::style;
use tokio::fs;

use crate::{
context::ServiceContextData,
context::{ProjectContext, ProjectContextData},
context::{ProjectContext, ProjectContextData, ServiceContextData},
dep, tasks,
utils::{self, command_helper::CommandHelper},
};
Expand Down
10 changes: 5 additions & 5 deletions lib/bolt/core/src/tasks/config/generate.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use anyhow::*;
use duct::cmd;
use rand::{distributions::Alphanumeric, prelude::*};
use std::{
future::Future,
path::{Path, PathBuf},
};
use tokio::fs;
use tokio::task::block_in_place;

use anyhow::*;
use duct::cmd;
use rand::{distributions::Alphanumeric, prelude::*};
use tokio::{fs, task::block_in_place};
use toml_edit::value;
use uuid::Uuid;

Expand Down
1 change: 0 additions & 1 deletion lib/bolt/core/src/tasks/infra/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use anyhow::*;

use tokio::time::Instant;

use crate::{
Expand Down
3 changes: 1 addition & 2 deletions lib/bolt/core/src/tasks/ssh.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{io::Write, os::unix::fs::PermissionsExt};
use std::{path::Path, sync::Arc};
use std::{io::Write, os::unix::fs::PermissionsExt, path::Path, sync::Arc};

use anyhow::*;
use duct::cmd;
Expand Down
2 changes: 1 addition & 1 deletion lib/bolt/core/src/utils/command_helper.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use anyhow::*;
use std::{
fmt::Display,
io::Write,
process::{Command, Stdio},
};

use anyhow::*;
use async_trait::async_trait;
use tokio::task;

Expand Down
3 changes: 1 addition & 2 deletions lib/bolt/core/src/utils/db_conn.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use std::{collections::HashMap, sync::Arc};
use urlencoding::encode;

use anyhow::*;

use indoc::indoc;
use urlencoding::encode;

use crate::{
config::{self, service::RuntimeKind},
Expand Down
3 changes: 2 additions & 1 deletion lib/cache/build/src/inner.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use rivet_pools::prelude::*;
use std::{env, fmt::Debug, sync::Arc};

use rivet_pools::prelude::*;

use super::*;

pub type Cache = Arc<CacheInner>;
Expand Down
2 changes: 1 addition & 1 deletion lib/cache/build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ mod error;
mod getter_ctx;
mod inner;
mod key;
mod metrics;
mod rate_limit;
mod req_config;
mod metrics;

pub use error::*;
pub use getter_ctx::*;
Expand Down
3 changes: 2 additions & 1 deletion lib/cache/build/src/rate_limit.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use super::*;
use futures_util::StreamExt;
use rivet_cache_result::RateLimitResult;

use super::*;

pub struct RateLimitConfig {
pub key: String,
pub buckets: Vec<RateLimitBucketConfig>,
Expand Down
8 changes: 4 additions & 4 deletions lib/cache/build/src/req_config.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
use redis::AsyncCommands;
use rivet_pools::prelude::*;
use std::{
fmt::Debug,
future::Future,
time::{Duration, SystemTime},
};

use redis::AsyncCommands;
use rivet_pools::prelude::*;
use tracing::Instrument;

use super::*;
use crate::{
error::{Error, GetterResult},
metrics,
};

use super::*;

/// Config specifying how cached values will behave.
#[derive(Clone)]
pub struct RequestConfig {
Expand Down
3 changes: 2 additions & 1 deletion lib/cache/build/tests/integration.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use rand::{seq::IteratorRandom, thread_rng, Rng};
use std::{
collections::{HashMap, HashSet},
sync::Arc,
time::Duration,
};

use rand::{seq::IteratorRandom, thread_rng, Rng};
use uuid::Uuid;

async fn build_cache() -> rivet_cache::Cache {
Expand Down
Loading

0 comments on commit ca8a61e

Please sign in to comment.