Skip to content

Commit cc5c846

Browse files
committed
chore: cargo fmt for edition 2024
1 parent dff0d95 commit cc5c846

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+103
-97
lines changed

examples/http_server/main.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ mod settings;
1313

1414
use self::settings::{EndpointSettings, HttpServerSettings, ResponseSettings};
1515
use anyhow::anyhow;
16+
use foundations::BootstrapResult;
1617
use foundations::addr::ListenAddr;
1718
use foundations::cli::{Arg, ArgAction, Cli};
1819
use foundations::settings::collections::Map;
19-
use foundations::telemetry::{self, log, tracing, TelemetryConfig, TelemetryContext};
20-
use foundations::BootstrapResult;
20+
use foundations::telemetry::{self, TelemetryConfig, TelemetryContext, log, tracing};
2121
use futures_util::stream::{FuturesUnordered, StreamExt};
2222
use http_body_util::Full;
2323
use hyper::body::{Bytes, Incoming};
@@ -38,10 +38,12 @@ async fn main() -> BootstrapResult<()> {
3838
// the config without running the server.
3939
let cli = Cli::<HttpServerSettings>::new(
4040
&service_info,
41-
vec![Arg::new("dry-run")
42-
.long("dry-run")
43-
.action(ArgAction::SetTrue)
44-
.help("Validate or generate config without running the server")],
41+
vec![
42+
Arg::new("dry-run")
43+
.long("dry-run")
44+
.action(ArgAction::SetTrue)
45+
.help("Validate or generate config without running the server"),
46+
],
4547
)?;
4648

4749
// Exit if we just want to check the config.
@@ -253,7 +255,7 @@ fn sandbox_syscalls() -> BootstrapResult<()> {
253255
use foundations::security::common_syscall_allow_lists::{
254256
ASYNC, NET_SOCKET_API, SERVICE_BASICS,
255257
};
256-
use foundations::security::{allow_list, enable_syscall_sandboxing, ViolationAction};
258+
use foundations::security::{ViolationAction, allow_list, enable_syscall_sandboxing};
257259

258260
allow_list! {
259261
static ALLOWED = [

examples/http_server/metrics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use foundations::telemetry::metrics::{metrics, Counter, Gauge};
1+
use foundations::telemetry::metrics::{Counter, Gauge, metrics};
22
use std::sync::Arc;
33

44
#[metrics]

foundations-macros/src/info_metric/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ use crate::common::Result;
22
use darling::FromMeta;
33
use proc_macro::TokenStream;
44
use proc_macro2::Span;
5-
use quote::{quote, ToTokens};
5+
use quote::{ToTokens, quote};
66
use syn::punctuated::Punctuated;
77
use syn::{
8-
parse_macro_input, parse_quote, Attribute, Ident, LitStr, Path, Token, Type, Visibility,
8+
Attribute, Ident, LitStr, Path, Token, Type, Visibility, parse_macro_input, parse_quote,
99
};
1010

1111
mod parsing;

foundations-macros/src/info_metric/parsing.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use super::{Field, FieldAttrs, MacroArgs, Struct, StructAttrs};
2-
use crate::common::{error, parse_attr_value, parse_meta_list, Result};
2+
use crate::common::{Result, error, parse_attr_value, parse_meta_list};
33
use darling::FromMeta;
44
use syn::parse::{Parse, ParseStream};
55
use syn::punctuated::Punctuated;
6-
use syn::{braced, Attribute, LitStr};
6+
use syn::{Attribute, LitStr, braced};
77

88
const STRUCT_ATTR_ERROR: &str = "Only `#[cfg]` and `#[doc]` are allowed on structs";
99

foundations-macros/src/metrics/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
use darling::util::Flag;
21
use darling::FromMeta;
2+
use darling::util::Flag;
33
use proc_macro::TokenStream;
44
use proc_macro2::Span;
5-
use quote::{format_ident, quote, ToTokens};
5+
use quote::{ToTokens, format_ident, quote};
66
use syn::punctuated::Punctuated;
77
use syn::{
8-
parse_macro_input, parse_quote, Attribute, ExprStruct, Ident, LitStr, Path, Token, Type,
9-
Visibility,
8+
Attribute, ExprStruct, Ident, LitStr, Path, Token, Type, Visibility, parse_macro_input,
9+
parse_quote,
1010
};
1111

1212
mod parsing;
@@ -448,7 +448,7 @@ mod tests {
448448
use super::*;
449449
use crate::common::test_utils::{code_str, parse_attr};
450450
use crate::metrics::validation;
451-
use syn::{parse_quote, ExprStruct};
451+
use syn::{ExprStruct, parse_quote};
452452

453453
#[test]
454454
fn expand_empty() {

foundations-macros/src/metrics/parsing.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
use super::{ArgAttrs, ArgMode, FnArg, FnAttrs, ItemFn, MacroArgs, Mod};
2-
use crate::common::{error, parse_attr_value, parse_meta_list, Result};
2+
use crate::common::{Result, error, parse_attr_value, parse_meta_list};
33
use darling::FromMeta;
44
use syn::parse::{Parse, ParseStream};
55
use syn::punctuated::Punctuated;
66
use syn::{
7-
braced, parenthesized, AngleBracketedGenericArguments, Attribute, GenericArgument,
8-
PathArguments, Token, TraitBound, TraitBoundModifier, Type, TypeImplTrait, TypeParamBound,
7+
AngleBracketedGenericArguments, Attribute, GenericArgument, PathArguments, Token, TraitBound,
8+
TraitBoundModifier, Type, TypeImplTrait, TypeParamBound, braced, parenthesized,
99
};
1010

1111
const IMPL_TRAIT_ERROR: &str = "Only `impl Into<T>` is allowed";
1212

13-
const FN_ATTR_ERROR: &str =
14-
"Only `#[cfg]`, `#[doc]`, `#[ctor]`, `#[optional]`, and `#[with_removal]` are allowed on functions";
13+
const FN_ATTR_ERROR: &str = "Only `#[cfg]`, `#[doc]`, `#[ctor]`, `#[optional]`, and `#[with_removal]` are allowed on functions";
1514

1615
const DUPLICATE_CTOR_ATTR_ERROR: &str = "Duplicate `#[ctor]` attribute";
1716
const DUPLICATE_OPTIONAL_ATTR_ERROR: &str = "Duplicate `#[optional]` attribute";

foundations-macros/src/settings.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
use crate::common::{error, parse_meta_list, Result};
2-
use darling::ast::NestedMeta;
1+
use crate::common::{Result, error, parse_meta_list};
32
use darling::FromMeta;
3+
use darling::ast::NestedMeta;
44
use proc_macro::TokenStream;
5-
use quote::{quote, quote_spanned, TokenStreamExt};
5+
use quote::{TokenStreamExt, quote, quote_spanned};
66
use syn::parse::{Parse, ParseStream};
77
use syn::spanned::Spanned;
88
use syn::{
9-
parse_macro_input, parse_quote, Attribute, Expr, ExprLit, Field, Fields, Ident, Item, ItemEnum,
10-
ItemStruct, Lit, LitStr, Meta, MetaNameValue, Path, Type,
9+
Attribute, Expr, ExprLit, Field, Fields, Ident, Item, ItemEnum, ItemStruct, Lit, LitStr, Meta,
10+
MetaNameValue, Path, Type, parse_macro_input, parse_quote,
1111
};
1212

1313
const ERR_NOT_STRUCT_OR_ENUM: &str = "Settings should be either structure or enum.";
1414

15-
const ERR_NON_UNIT_OR_NEW_TYPE_VARIANT: &str =
16-
"Settings enum variant should either be a unit variant (e.g. `Enum::Foo`) \
15+
const ERR_NON_UNIT_OR_NEW_TYPE_VARIANT: &str = "Settings enum variant should either be a unit variant (e.g. `Enum::Foo`) \
1716
or a new type variant (e.g. `Enum::Foo(Bar)`).";
1817

1918
const ERR_TUPLE_STRUCT: &str =

foundations-macros/src/span_fn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ use crate::common::parse_optional_trailing_meta_list;
22
use darling::FromMeta;
33
use proc_macro::TokenStream;
44
use proc_macro2::{Span, TokenStream as TokenStream2};
5-
use quote::{quote, ToTokens};
5+
use quote::{ToTokens, quote};
66
use syn::parse::{Parse, ParseStream};
7-
use syn::{parse_quote, Block, Expr, ExprCall, ItemFn, LitStr, Path, Signature, Stmt};
7+
use syn::{Block, Expr, ExprCall, ItemFn, LitStr, Path, Signature, Stmt, parse_quote};
88

99
const ERR_APPLIED_TO_NON_FN: &str = "`span_fn` macro can only be used on functions";
1010

foundations-macros/src/with_test_telemetry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use proc_macro::TokenStream;
44
use proc_macro2::{Span, TokenStream as TokenStream2};
55
use quote::quote;
66
use syn::parse::{Parse, ParseStream};
7-
use syn::{parse_quote, Ident, ItemFn, Path, Signature};
7+
use syn::{Ident, ItemFn, Path, Signature, parse_quote};
88

99
const ERR_APPLIED_TO_NON_FN: &str = "`with_test_telemetry` macro can only be used on functions";
1010
const ERR_NON_TEST_FN: &str = "`with_test_telemetry` can wrap only `test` or `tokio::test`";

foundations/src/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use super::settings::Settings;
44
use super::{BootstrapResult, ServiceInfo};
55
use anyhow::anyhow;
6-
use clap::error::ErrorKind;
76
use clap::Command;
7+
use clap::error::ErrorKind;
88
use std::ffi::OsString;
99

1010
pub use clap::{Arg, ArgAction, ArgMatches};

0 commit comments

Comments
 (0)