Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rustfmt 3836 v4 #10303

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ jobs:
- run: ./scripts/bundle.sh
- run: ./autogen.sh
- run: ./configure
- run: cargo fmt --check
working-directory: rust
- run: cargo clippy --all-features --fix --allow-no-vcs
working-directory: rust
- run: |
Expand Down
4 changes: 3 additions & 1 deletion rust/derive/src/applayerevent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ pub fn derive_app_layer_event(input: TokenStream) -> TokenStream {
// "crate", but if we're being used by a library or plugin user we need to reference the
// Suricata name space as "suricata". Check the CARGO_PKG_NAME environment variable to
// determine what identifier to setup.
let is_suricata = std::env::var("CARGO_PKG_NAME").map(|var| var == "suricata").unwrap_or(false);
let is_suricata = std::env::var("CARGO_PKG_NAME")
.map(|var| var == "suricata")
.unwrap_or(false);
let crate_id = if is_suricata {
syn::Ident::new("crate", proc_macro2::Span::call_site())
} else {
Expand Down
13 changes: 10 additions & 3 deletions rust/derive/src/stringenum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ extern crate proc_macro;
use super::applayerevent::transform_name;
use proc_macro::TokenStream;
use quote::quote;
use syn::{self, parse_macro_input, DeriveInput};
use std::str::FromStr;
use syn::{self, parse_macro_input, DeriveInput};

pub fn derive_enum_string<T: std::str::FromStr + quote::ToTokens>(input: TokenStream, ustr: &str) -> TokenStream where <T as FromStr>::Err: std::fmt::Display {
pub fn derive_enum_string<T: std::str::FromStr + quote::ToTokens>(
input: TokenStream, ustr: &str,
) -> TokenStream
where
<T as FromStr>::Err: std::fmt::Display,
{
let input = parse_macro_input!(input as DeriveInput);
let name = input.ident;
let mut values = Vec::new();
Expand Down Expand Up @@ -56,7 +61,9 @@ pub fn derive_enum_string<T: std::str::FromStr + quote::ToTokens>(input: TokenSt
panic!("EnumString can only be derived for enums");
}

let is_suricata = std::env::var("CARGO_PKG_NAME").map(|var| var == "suricata").unwrap_or(false);
let is_suricata = std::env::var("CARGO_PKG_NAME")
.map(|var| var == "suricata")
.unwrap_or(false);
let crate_id = if is_suricata {
syn::Ident::new("crate", proc_macro2::Span::call_site())
} else {
Expand Down
1 change: 1 addition & 0 deletions rust/rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# we expect the default formatting rules to be used.

fn_params_layout = "compressed"
force_explicit_abi = false