Skip to content

Commit 708a4c5

Browse files
authored
Merge pull request #82 from auto-impl-rs/chore/fmt
Run fmt
2 parents 8a830f1 + aac67de commit 708a4c5

File tree

10 files changed

+1
-61
lines changed

10 files changed

+1
-61
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,3 @@ jobs:
2929
- name: Run compile-fail tests
3030
if: matrix.rust-version == 'stable'
3131
run: cargo test -- ui_compile_fail
32-
33-
- name: Build with nightly feature
34-
if: matrix.rust-version == 'nightly'
35-
run: cargo build --features=nightly
36-
- name: Run tests with nightly feature
37-
if: matrix.rust-version == 'nightly'
38-
run: cargo test --features=nightly -- --skip ui_compile_fail

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ rust-version = "1.37"
2020
[lib]
2121
proc-macro = true
2222

23-
[features]
24-
nightly = []
25-
2623
[dependencies]
2724
proc-macro2 = "1.0"
2825
quote = "1.0"

examples/error_messages.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
use auto_impl::auto_impl;
1010

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

27-
2826
fn main() {}

examples/greet_closure.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use auto_impl::auto_impl;
22

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

24-
2523
fn greet_people(greeter: impl Greeter) {
2624
greeter.greet("Anna");
2725
greeter.greet("Bob");
2826
}
2927

30-
3128
fn main() {
3229
// We can simply pass a closure here, since this specific closure
3330
// implements `Fn(&str)` and therefore also `Greeter`. Note that we need

examples/keep_default_for.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//! type.
88
use auto_impl::auto_impl;
99

10-
1110
#[auto_impl(&, Box)]
1211
trait Foo {
1312
fn required(&self) -> String;

examples/refs.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use std::fmt::Display;
22

33
use auto_impl::auto_impl;
44

5-
65
/// This trait can be implemented for all reference or pointer types: &, &mut,
76
/// Box, Rc and Arc.
87
///

rustfmt.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ unstable_features = true
22

33
blank_lines_upper_bound = 3
44
format_macro_matchers = true
5-
merge_imports = true
5+
imports_granularity="Crate"
66
normalize_comments = true
77
reorder_impl_items = true

src/analyze.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use syn::{
66
Block, Ident, ItemTrait, Lifetime,
77
};
88

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

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

71-
7269
fn char_to_ident(c: u8) -> Ident {
7370
let arr = [c];
7471
let s = ::std::str::from_utf8(&arr).unwrap();
@@ -95,19 +92,6 @@ pub(crate) fn find_suitable_param_names(trait_def: &ItemTrait) -> (Ident, Lifeti
9592
(ty_name, lt)
9693
}
9794

98-
/// On nightly, we use `def_site` hygiene which puts our names into another
99-
/// universe than the names of the user. This is not strictly required as our
100-
/// name is already pretty much guaranteed to not conflict with another name,
101-
/// but this is cleaner and just the correct thing to do.
102-
#[cfg(feature = "nightly")]
103-
fn param_span() -> Span2 {
104-
crate::proc_macro::Span::def_site().into()
105-
}
106-
107-
/// On stable, we use `call_site()` hygiene. That means that our names could
108-
/// theoretically collide with names of the user. But we made sure this doesn't
109-
/// happen.
110-
#[cfg(not(feature = "nightly"))]
11195
fn param_span() -> Span2 {
11296
Span2::call_site()
11397
}

src/lib.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -202,31 +202,6 @@
202202
//! }
203203
//! }
204204
//! ```
205-
//!
206-
//!
207-
//! # The `nightly` feature gate
208-
//!
209-
//! By default, this crate compiles on stable. If you don't need stable support,
210-
//! you can enable the `nightly` feature of this crate:
211-
//!
212-
//! ```toml
213-
//! [dependencies]
214-
//! auto_impl = { version = "*", features = ["nightly"] }
215-
//! ```
216-
//!
217-
//! The nightly feature enables a few additional features that are not
218-
//! available on stable yet. Currently, you get these advantages:
219-
//! - All idents generated by auto_impl use the `def_site` hygiene and
220-
//! therefore will never ever have name collisions with user written idents.
221-
//! Note that `auto_impl` already (even without nightly feature) takes care
222-
//! that idents never collide, if possible. But `def_site` hygiene is still
223-
//! technically the more correct solution.
224-
225-
#![cfg_attr(
226-
feature = "nightly",
227-
feature(proc_macro_diagnostic, proc_macro_span, proc_macro_def_site)
228-
)]
229-
230205
231206
extern crate proc_macro;
232207
#[macro_use]
@@ -237,7 +212,6 @@ use proc_macro2::TokenStream as TokenStream2;
237212
use proc_macro_error::{abort_call_site, proc_macro_error, set_dummy};
238213
use quote::ToTokens;
239214

240-
241215
mod analyze;
242216
mod attr;
243217
mod gen;

src/proxy.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ fn eat_type(iter: &mut Peekable<token_stream::IntoIter>) -> Result<ProxyType, ()
143143
Ok(ty)
144144
}
145145

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

0 commit comments

Comments
 (0)