Skip to content

Commit

Permalink
run fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
KodrAus committed Jun 1, 2022
1 parent 9ce12d2 commit c29280c
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 14 deletions.
2 changes: 0 additions & 2 deletions examples/error_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

use auto_impl::auto_impl;


// Shows the error message for the case that `#[auto_impl]` was used with
// incorrect proxy types. Only proxy types like `&` and `Box` are allowed. Add
// this next line to see the error!
Expand All @@ -24,5 +23,4 @@ struct Bar {
x: u32,
}


fn main() {}
3 changes: 0 additions & 3 deletions examples/greet_closure.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use auto_impl::auto_impl;


/// This simple trait can be implemented for `Fn` types, but not for `FnMut` or
/// `FnOnce` types. The latter two types require a mutable reference to `self`
/// or a `self` by value to be called, but `greet()` only has an immutable
Expand All @@ -21,13 +20,11 @@ trait Greeter {
fn greet(&self, name: &str);
}


fn greet_people(greeter: impl Greeter) {
greeter.greet("Anna");
greeter.greet("Bob");
}


fn main() {
// We can simply pass a closure here, since this specific closure
// implements `Fn(&str)` and therefore also `Greeter`. Note that we need
Expand Down
1 change: 0 additions & 1 deletion examples/keep_default_for.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//! type.
use auto_impl::auto_impl;


#[auto_impl(&, Box)]
trait Foo {
fn required(&self) -> String;
Expand Down
1 change: 0 additions & 1 deletion examples/refs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::fmt::Display;

use auto_impl::auto_impl;


/// This trait can be implemented for all reference or pointer types: &, &mut,
/// Box, Rc and Arc.
///
Expand Down
2 changes: 1 addition & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ unstable_features = true

blank_lines_upper_bound = 3
format_macro_matchers = true
merge_imports = true
imports_granularity="Crate"
normalize_comments = true
reorder_impl_items = true
3 changes: 0 additions & 3 deletions src/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use syn::{
Block, Ident, ItemTrait, Lifetime,
};


/// The type parameter used in the proxy type. Usually, one would just use `T`,
/// but this could conflict with type parameters on the trait.
///
Expand All @@ -21,7 +20,6 @@ const PROXY_TY_PARAM_NAME: &str = "__AutoImplProxyT";
/// `&mut`. For more information see `PROXY_TY_PARAM_NAME`.
const PROXY_LT_PARAM_NAME: &str = "'__auto_impl_proxy_lifetime";


/// We need to introduce our own type and lifetime parameter. Regardless of
/// what kind of hygiene we use for the parameter, it would be nice (for docs
/// and compiler errors) if the names are as simple as possible ('a and T, for
Expand Down Expand Up @@ -68,7 +66,6 @@ pub(crate) fn find_suitable_param_names(trait_def: &ItemTrait) -> (Ident, Lifeti
};
visit_item_trait(&mut visitor, trait_def);


fn char_to_ident(c: u8) -> Ident {
let arr = [c];
let s = ::std::str::from_utf8(&arr).unwrap();
Expand Down
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@
feature(proc_macro_diagnostic, proc_macro_span, proc_macro_def_site)
)]


extern crate proc_macro;
#[macro_use]
extern crate quote;
Expand All @@ -237,7 +236,6 @@ use proc_macro2::TokenStream as TokenStream2;
use proc_macro_error::{abort_call_site, proc_macro_error, set_dummy};
use quote::ToTokens;


mod analyze;
mod attr;
mod gen;
Expand Down
1 change: 0 additions & 1 deletion src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ fn eat_type(iter: &mut Peekable<token_stream::IntoIter>) -> Result<ProxyType, ()
Ok(ty)
}


// Right now, we can't really write useful tests. Many functions from
// `proc_macro` use a compiler internal session. This session is only valid
// when we were actually called as a proc macro. We need to add tests once
Expand Down

0 comments on commit c29280c

Please sign in to comment.