Skip to content

Commit

Permalink
Run cargo fmt in derive crate
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Dec 12, 2024
1 parent 5de5312 commit 2481f86
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- uses: actions/checkout@v4
- name: Setup Rust Toolchain
uses: ./.github/actions/setup-builder
- run: cargo fmt -- --check
- run: cargo fmt --all -- --check

lint:
runs-on: ubuntu-latest
Expand Down
12 changes: 10 additions & 2 deletions derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
use proc_macro2::TokenStream;
use quote::{format_ident, quote, quote_spanned, ToTokens};
use syn::spanned::Spanned;
use syn::{parse::{Parse, ParseStream}, parse_macro_input, parse_quote, Attribute, Data, DeriveInput, Fields, GenericParam, Generics, Ident, Index, LitStr, Meta, Token, Type, TypePath};
use syn::{
parse::{Parse, ParseStream},
parse_macro_input, parse_quote, Attribute, Data, DeriveInput, Fields, GenericParam, Generics,
Ident, Index, LitStr, Meta, Token, Type, TypePath,
};
use syn::{Path, PathArguments};

/// Implementation of `[#derive(Visit)]`
Expand Down Expand Up @@ -267,7 +271,11 @@ fn visit_children(
}

fn is_option(ty: &Type) -> bool {
if let Type::Path(TypePath { path: Path { segments, .. }, .. }) = ty {
if let Type::Path(TypePath {
path: Path { segments, .. },
..
}) = ty
{
if let Some(segment) = segments.last() {
if segment.ident == "Option" {
if let PathArguments::AngleBracketed(args) = &segment.arguments {
Expand Down

0 comments on commit 2481f86

Please sign in to comment.