Skip to content

Commit 42df924

Browse files
committed
cargo fmt
1 parent 1339dfd commit 42df924

File tree

4 files changed

+27
-26
lines changed

4 files changed

+27
-26
lines changed

dynomite-derive/src/attr.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ pub(crate) enum AttrKind {
2727
}
2828

2929
impl Attr {
30-
fn new(ident: Ident, kind: AttrKind) -> Self {
30+
fn new(
31+
ident: Ident,
32+
kind: AttrKind,
33+
) -> Self {
3134
Self { ident, kind }
3235
}
3336
}

dynomite-derive/src/lib.rs

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use attr::{Attr, AttrKind};
3333

3434
use proc_macro::TokenStream;
3535
use proc_macro2::Span;
36-
use proc_macro_error::{ResultExt, abort};
36+
use proc_macro_error::{abort, ResultExt};
3737
use quote::{quote, ToTokens};
3838
use syn::{
3939
punctuated::Punctuated,
@@ -54,7 +54,11 @@ impl<'a> ItemField<'a> {
5454
let attrs = parse_attrs(&field.attrs);
5555
let me = Self { field, attrs };
5656
if me.is_flatten() {
57-
if let Some(it) = me.attrs.iter().find(|it| !matches!(it.kind, AttrKind::Flatten)) {
57+
if let Some(it) = me
58+
.attrs
59+
.iter()
60+
.find(|it| !matches!(it.kind, AttrKind::Flatten))
61+
{
5862
abort!(
5963
it.ident,
6064
"If #[dynomite(flatten)] is used, no other dynomite attributes are allowed on the field"
@@ -381,25 +385,23 @@ fn get_to_attribute_map_trait(
381385
// values
382386
// }
383387
fn get_to_attrs_function(fields: &[ItemField]) -> syn::Result<impl ToTokens> {
384-
let field_conversions = fields
385-
.iter()
386-
.map(|field| {
387-
let field_deser_name = field.deser_name();
388-
let field_ident = &field.field.ident;
388+
let field_conversions = fields.iter().map(|field| {
389+
let field_deser_name = field.deser_name();
390+
let field_ident = &field.field.ident;
389391

390-
if field.is_flatten() {
391-
quote! {
392-
self.#field_ident.__to_attrs(attrs);
393-
}
394-
} else {
395-
quote! {
396-
attrs.insert(
397-
#field_deser_name.to_string(),
398-
::dynomite::Attribute::into_attr(self.#field_ident)
399-
);
400-
}
392+
if field.is_flatten() {
393+
quote! {
394+
self.#field_ident.__to_attrs(attrs);
401395
}
402-
});
396+
} else {
397+
quote! {
398+
attrs.insert(
399+
#field_deser_name.to_string(),
400+
::dynomite::Attribute::into_attr(self.#field_ident)
401+
);
402+
}
403+
}
404+
});
403405

404406
Ok(quote! {
405407
// Used to serialize into an attributes map without creating a temporary map

dynomite/src/retry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
//! // appropriate
1717
//! let tables = client.list_tables(Default::default());
1818
//! ```
19-
//!
19+
2020
use crate::dynamodb::*;
2121
use again::{Condition, RetryPolicy};
2222
use log::debug;

dynomite/tests/derived.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ struct FlattenedNested {
5757
c: bool,
5858
}
5959

60-
6160
#[cfg(test)]
6261
mod tests {
6362

@@ -112,10 +111,7 @@ mod tests {
112111
id: "foo".into(),
113112
flat: Flattened {
114113
a: true,
115-
flat_nested: FlattenedNested {
116-
b: 42,
117-
c: false,
118-
},
114+
flat_nested: FlattenedNested { b: 42, c: false },
119115
},
120116
};
121117

0 commit comments

Comments
 (0)