Skip to content

Commit aa6dbe2

Browse files
committed
rustfmt: set style_edition = "2024"
1 parent f49dc13 commit aa6dbe2

File tree

13 files changed

+29
-41
lines changed

13 files changed

+29
-41
lines changed

.rustfmt.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ error_on_line_overflow = true
88
# Override the default formatting style.
99
# See https://internals.rust-lang.org/t/running-rustfmt-on-rust-lang-rust-and-other-rust-lang-repositories/8732/81.
1010
use_small_heuristics = "Max"
11-
# This is the default of 2024 edition https://github.com/rust-lang/rust/pull/114764.
1211
# This is unstable (tracking issue: https://github.com/rust-lang/rustfmt/issues/3370)
1312
overflow_delimited_expr = true
1413
# This is unstable (tracking issue: https://github.com/rust-lang/rustfmt/issues/4991).
@@ -27,6 +26,7 @@ use_try_shorthand = true
2726
# Set the default settings again to always apply the proper formatting without
2827
# being affected by the editor settings.
2928
edition = "2021"
29+
style_edition = "2024"
3030
hard_tabs = false
3131
newline_style = "Unix"
3232
tab_spaces = 4

examples/unsafe_unpin-expanded.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
clippy::undocumented_unsafe_blocks
3030
)]
3131

32-
use pin_project::{pin_project, UnsafeUnpin};
32+
use pin_project::{UnsafeUnpin, pin_project};
3333

3434
// #[pin_project(UnsafeUnpin)]
3535
struct Struct<T, U> {

examples/unsafe_unpin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#![allow(dead_code, clippy::undocumented_unsafe_blocks)]
66

7-
use pin_project::{pin_project, UnsafeUnpin};
7+
use pin_project::{UnsafeUnpin, pin_project};
88

99
#[pin_project(UnsafeUnpin)]
1010
struct Struct<T, U> {

pin-project-internal/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ use proc_macro::TokenStream;
315315
/// argument to `#[pin_project]`.
316316
///
317317
/// ```
318-
/// use pin_project::{pin_project, UnsafeUnpin};
318+
/// use pin_project::{UnsafeUnpin, pin_project};
319319
///
320320
/// #[pin_project(UnsafeUnpin)]
321321
/// struct Struct<T, U> {

pin-project-internal/src/pin_project/args.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
use proc_macro2::{Span, TokenStream};
44
use quote::quote;
55
use syn::{
6+
Attribute, Error, Ident, Result, Token,
67
parse::{Parse, ParseStream},
78
spanned::Spanned as _,
8-
Attribute, Error, Ident, Result, Token,
99
};
1010

1111
use super::PIN;
@@ -245,10 +245,6 @@ impl ProjReplace {
245245
}
246246

247247
pub(super) fn ident(&self) -> Option<&Ident> {
248-
if let Self::Named { ident, .. } = self {
249-
Some(ident)
250-
} else {
251-
None
252-
}
248+
if let Self::Named { ident, .. } = self { Some(ident) } else { None }
253249
}
254250
}

pin-project-internal/src/pin_project/attribute.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use proc_macro2::TokenStream;
44
use quote::quote;
55
use syn::{
6-
parse::{Parse, ParseStream},
76
Attribute, Result, Token, Visibility,
7+
parse::{Parse, ParseStream},
88
};
99

1010
use super::PIN;

pin-project-internal/src/pin_project/derive.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
// SPDX-License-Identifier: Apache-2.0 OR MIT
22

33
use proc_macro2::{Delimiter, Group, Span, TokenStream};
4-
use quote::{format_ident, quote, quote_spanned, ToTokens as _};
4+
use quote::{ToTokens as _, format_ident, quote, quote_spanned};
55
use syn::{
6-
parse_quote, punctuated::Punctuated, token, visit_mut::VisitMut as _, Attribute, Error, Field,
7-
Fields, FieldsNamed, FieldsUnnamed, Generics, Ident, Index, Item, Lifetime, LifetimeParam,
8-
Meta, Result, Token, Type, Variant, Visibility, WhereClause,
6+
Attribute, Error, Field, Fields, FieldsNamed, FieldsUnnamed, Generics, Ident, Index, Item,
7+
Lifetime, LifetimeParam, Meta, Result, Token, Type, Variant, Visibility, WhereClause,
8+
parse_quote, punctuated::Punctuated, token, visit_mut::VisitMut as _,
99
};
1010

1111
use super::{
12-
args::{parse_args, Args, ProjReplace, UnpinImpl},
1312
PIN,
13+
args::{Args, ProjReplace, UnpinImpl, parse_args},
1414
};
1515
use crate::utils::{
16-
determine_lifetime_name, determine_visibility, insert_lifetime_and_bound, ReplaceReceiver,
17-
SliceExt as _, Variants,
16+
ReplaceReceiver, SliceExt as _, Variants, determine_lifetime_name, determine_visibility,
17+
insert_lifetime_and_bound,
1818
};
1919

2020
pub(super) fn parse_derive(input: TokenStream) -> Result<TokenStream> {

pin-project-internal/src/pinned_drop.rs

+6-14
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// SPDX-License-Identifier: Apache-2.0 OR MIT
22

33
use proc_macro2::{Span, TokenStream};
4-
use quote::{format_ident, quote, ToTokens as _};
4+
use quote::{ToTokens as _, format_ident, quote};
55
use syn::{
6-
parse_quote, spanned::Spanned as _, token::Colon, visit_mut::VisitMut as _, Error, FnArg,
7-
GenericArgument, Ident, ImplItem, ItemImpl, Pat, PatIdent, PatType, Path, PathArguments,
8-
Result, ReturnType, Signature, Token, Type, TypePath, TypeReference,
6+
Error, FnArg, GenericArgument, Ident, ImplItem, ItemImpl, Pat, PatIdent, PatType, Path,
7+
PathArguments, Result, ReturnType, Signature, Token, Type, TypePath, TypeReference,
8+
parse_quote, spanned::Spanned as _, token::Colon, visit_mut::VisitMut as _,
99
};
1010

1111
use crate::utils::{ReplaceReceiver, SliceExt as _};
@@ -91,11 +91,7 @@ fn validate_impl(item: &ItemImpl) -> Result<()> {
9191
}
9292
ImplItem::Fn(method) => {
9393
validate_sig(&method.sig)?;
94-
if i == 0 {
95-
Ok(())
96-
} else {
97-
bail!(method, "duplicate definitions with name `drop`")
98-
}
94+
if i == 0 { Ok(()) } else { bail!(method, "duplicate definitions with name `drop`") }
9995
}
10096
_ => unreachable!("unexpected ImplItem"),
10197
})
@@ -106,11 +102,7 @@ fn validate_impl(item: &ItemImpl) -> Result<()> {
106102
/// The correct signature is: `(mut) self: (<path>::)Pin<&mut Self>`
107103
fn validate_sig(sig: &Signature) -> Result<()> {
108104
fn get_ty_path(ty: &Type) -> Option<&Path> {
109-
if let Type::Path(TypePath { qself: None, path }) = ty {
110-
Some(path)
111-
} else {
112-
None
113-
}
105+
if let Type::Path(TypePath { qself: None, path }) = ty { Some(path) } else { None }
114106
}
115107

116108
const INVALID_ARGUMENT: &str = "method `drop` must take an argument `self: Pin<&mut Self>`";

pin-project-internal/src/utils.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
use std::mem;
44

55
use proc_macro2::{Group, Spacing, Span, TokenStream, TokenTree};
6-
use quote::{quote, quote_spanned, ToTokens};
6+
use quote::{ToTokens, quote, quote_spanned};
77
use syn::{
8+
Attribute, ExprPath, ExprStruct, Generics, Ident, Item, Lifetime, LifetimeParam, Macro,
9+
PatStruct, PatTupleStruct, Path, PathArguments, PredicateType, QSelf, Result, Token, Type,
10+
TypeParamBound, TypePath, Variant, Visibility, WherePredicate,
811
parse::{Parse, ParseBuffer, ParseStream},
912
parse_quote,
1013
punctuated::Punctuated,
1114
token,
1215
visit_mut::{self, VisitMut},
13-
Attribute, ExprPath, ExprStruct, Generics, Ident, Item, Lifetime, LifetimeParam, Macro,
14-
PatStruct, PatTupleStruct, Path, PathArguments, PredicateType, QSelf, Result, Token, Type,
15-
TypeParamBound, TypePath, Variant, Visibility, WherePredicate,
1616
};
1717

1818
pub(crate) type Variants = Punctuated<Variant, Token![,]>;

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ pub use pin_project_internal::pinned_drop;
162162
/// pinned fields be [`Unpin`], imposes an additional requirement:
163163
///
164164
/// ```
165-
/// use pin_project::{pin_project, UnsafeUnpin};
165+
/// use pin_project::{UnsafeUnpin, pin_project};
166166
///
167167
/// #[pin_project(UnsafeUnpin)]
168168
/// struct Struct<K, V> {

tests/auxiliary/macro/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#![allow(clippy::missing_panics_doc)]
44

55
use proc_macro::TokenStream;
6-
use quote::{format_ident, quote, ToTokens as _};
7-
use syn::{parse_quote, Field, FieldMutability, Fields, ItemStruct, Token, Visibility};
6+
use quote::{ToTokens as _, format_ident, quote};
7+
use syn::{Field, FieldMutability, Fields, ItemStruct, Token, Visibility, parse_quote};
88

99
fn tokens2(tokens: TokenStream) -> proc_macro2::TokenStream {
1010
tokens.into()

tests/pin_project.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use std::{
1717
pin::Pin,
1818
};
1919

20-
use pin_project::{pin_project, pinned_drop, UnsafeUnpin};
20+
use pin_project::{UnsafeUnpin, pin_project, pinned_drop};
2121

2222
#[test]
2323
fn projection() {

tests/unsafe_unpin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mod auxiliary;
77

88
use std::marker::PhantomPinned;
99

10-
use pin_project::{pin_project, UnsafeUnpin};
10+
use pin_project::{UnsafeUnpin, pin_project};
1111

1212
#[pin_project(UnsafeUnpin)]
1313
struct Blah<T, U> {

0 commit comments

Comments
 (0)