Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
Oyelowo committed Jul 10, 2024
1 parent e4c02bc commit 275680a
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 32 deletions.
2 changes: 1 addition & 1 deletion derive/src/migrations/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*/

use darling::FromDeriveInput;
use quote::quote;
use surreal_derive_helpers::migrations::table::TableMigrationSchemaDeriveAttributes;
use syn::parse_macro_input;
use quote::quote;

pub fn generate_table_resources_trait(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let input = parse_macro_input!(input);
Expand Down
3 changes: 0 additions & 3 deletions derive/src/models/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ use quote::quote;
use surreal_derive_helpers::models::EdgeToken;
use syn::parse_macro_input;




pub fn generate_fields_getter_trait(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let input = parse_macro_input!(input);
let output = match EdgeToken::from_derive_input(&input) {
Expand Down
3 changes: 1 addition & 2 deletions derive/src/models/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/

use darling::FromDeriveInput;
use surreal_derive_helpers::models::NodeToken;
use quote::quote;
use surreal_derive_helpers::models::NodeToken;
use syn::parse_macro_input;

pub fn generate_fields_getter_trait(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
Expand All @@ -18,4 +18,3 @@ pub fn generate_fields_getter_trait(input: proc_macro::TokenStream) -> proc_macr
};
quote!(#output).into()
}

2 changes: 1 addition & 1 deletion derive/src/models/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*/

use darling::FromDeriveInput;
use quote::quote;
use surreal_derive_helpers::models::ObjectToken;
use syn::parse_macro_input;
use quote::quote;

pub fn generate_fields_getter_trait(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
let input = parse_macro_input!(input);
Expand Down
1 change: 0 additions & 1 deletion derive_helpers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@

pub mod migrations;
pub mod models;

2 changes: 0 additions & 2 deletions derive_helpers/src/migrations/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ impl ToTokens for TableMigrationSchemaDeriveAttributes {
}
}


#[cfg(test)]
mod tests {
use super::*;
Expand All @@ -53,5 +52,4 @@ mod tests {

assert_eq!(tokens.to_string(), expected.to_string());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ mod tests {

assert_eq!(
quote!(#ty_to_replace).to_string(),
quote!(User<'a, 'b, U, T ,>).to_string()
quote!(User<'a, 'b, U, T>).to_string()
);
}

Expand All @@ -272,8 +272,6 @@ mod tests {
let type_with_self: syn::Type = syn::parse2(type_with_self).unwrap();
let ty_to_replace = replacer.replace_self(&type_with_self.into());



assert_eq!(
quote::quote!(#ty_to_replace).to_string(),
quote::quote!(User<'a, 'b, U, V>).to_string()
Expand Down
6 changes: 3 additions & 3 deletions derive_helpers/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ pub(crate) mod utils;
pub(crate) mod variables;

pub use casing::*;
pub use edge::*;
pub use errors::*;
pub use field_meta::*;
pub use keywords::*;
pub use node::*;
pub use object::*;
pub use table_meta::*;
pub use token_codegen::*;
pub use utils::*;
pub use variables::*;
pub use edge::*;
pub use node::*;
pub use object::*;

#[derive(Debug, Copy, Clone)]
pub enum DataType {
Expand Down
3 changes: 1 addition & 2 deletions derive_helpers/src/models/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

use std::ops::Deref;

use crate::models::*;
use darling::{FromDeriveInput, ToTokens};
use proc_macro2::TokenStream;
use proc_macros_helpers::get_crate_name;
use quote::quote;
use crate::models::*;

#[derive(Clone, Debug, FromDeriveInput)]
#[darling(attributes(surreal_orm, serde), forward_attrs(allow, doc, cfg))]
Expand Down Expand Up @@ -472,4 +472,3 @@ impl ToTokens for NodeToken {
));
}
}

2 changes: 1 addition & 1 deletion derive_helpers/src/models/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* Licensed under the MIT license
*/

use crate::models::*;
use darling::{ast, util, FromDeriveInput, ToTokens};
use proc_macro2::TokenStream;
use quote::quote;
use syn::Ident;
use crate::models::*;

#[derive(Debug, Clone, FromDeriveInput)]
#[darling(attributes(surreal_orm, serde), forward_attrs(allow, doc, cfg))]
Expand Down
2 changes: 0 additions & 2 deletions derive_helpers/tests/rstest.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


// #[cfg(test)]
// mod tests {
// use test_case::test_case;
Expand Down
13 changes: 4 additions & 9 deletions derive_helpers/tests/table_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,8 @@ use TableNameFormat::*;
#[test_case("student_table", Raw, Relax, Valid; "Node table snake case raw table name with struct name with relax")]
#[test_case("student_table", Stringified, NoRelax, Valid; "Node table snake case stringified table name version of struct name cannot be used without relax")]
#[test_case("student_table", Stringified, Relax, Valid; "Node table snake case stringified table name version of struct name can be used with relax")]

#[test_case("snake_case_but_wrong_name", Stringified, NoRelax, Invalid; "snake case different from even snake case version of struct name cannot be used with relax")]
#[test_case("snake_case_but_wrong_name", Stringified, Relax, Valid; "snake case different from even snake case version of struct name can be used with relax")]

#[test_case("StudentTable", Raw, NoRelax, Invalid; "non snake case raw table name version of struct name cannot be used without relax")]
#[test_case("StudentTable", Raw, Relax, Valid; "non snake case raw table name version of struct name cann be used with relax")]
#[test_case("StudentTable", Stringified, NoRelax, Invalid; "non snake case stringified table name version of struct name cannot be used without relax")]
Expand Down Expand Up @@ -128,14 +126,12 @@ fn test_node_table_name(
#[test_case("big_writes", Raw, Relax, Valid)]
#[test_case("big_writes", Stringified, NoRelax, Valid)]
#[test_case("big_writes", Stringified, Relax, Valid)]

#[test_case("snake_case_but_wrong_name", Stringified, NoRelax, Invalid)]
#[test_case("snake_case_but_wrong_name", Stringified, Relax, Valid)]

#[test_case("BigWrites", Raw, NoRelax, Invalid)]
#[test_case("BigWrites", Raw, Relax, Valid)]
#[test_case("BigWrites", Stringified, NoRelax, Invalid)]
#[test_case("BigWrites", Stringified, Relax, Valid)]
#[test_case("BigWrites", Raw, NoRelax, Invalid)]
#[test_case("BigWrites", Raw, Relax, Valid)]
#[test_case("BigWrites", Stringified, NoRelax, Invalid)]
#[test_case("BigWrites", Stringified, Relax, Valid)]
fn test_edge_table_name(
table_name: &str,
table_name_format: TableNameFormat,
Expand Down Expand Up @@ -187,4 +183,3 @@ fn test_edge_table_name(
Invalid => assert!(must_be_in_snake_case_error()),
}
}

1 change: 1 addition & 0 deletions derive_tests/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 0 additions & 2 deletions query-builder/src/validators/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,6 @@ macro_rules! check_unique_idents {
};
}



/// Checks that it is false
#[macro_export]
macro_rules! assert_not {
Expand Down

0 comments on commit 275680a

Please sign in to comment.