mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 07:17:56 +00:00
Run cargo fmt on the whole code base (#9394)
* Run cargo fmt on the whole code base * Second run * Add CI check * Fix compilation * More unnecessary braces * Handle weights * Use --all * Use correct attributes... * Fix UI tests * AHHHHHHHHH * 🤦 * Docs * Fix compilation * 🤷 * Please stop * 🤦 x 2 * More * make rustfmt.toml consistent with polkadot Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
@@ -77,9 +77,9 @@ impl Parse for WhereSection {
|
||||
definitions.push(definition);
|
||||
if !input.peek(Token![,]) {
|
||||
if !input.peek(token::Brace) {
|
||||
return Err(input.error("Expected `,` or `{`"));
|
||||
return Err(input.error("Expected `,` or `{`"))
|
||||
}
|
||||
break;
|
||||
break
|
||||
}
|
||||
input.parse::<Token![,]>()?;
|
||||
}
|
||||
@@ -87,23 +87,14 @@ impl Parse for WhereSection {
|
||||
let node_block = remove_kind(input, WhereKind::NodeBlock, &mut definitions)?.value;
|
||||
let unchecked_extrinsic =
|
||||
remove_kind(input, WhereKind::UncheckedExtrinsic, &mut definitions)?.value;
|
||||
if let Some(WhereDefinition {
|
||||
ref kind_span,
|
||||
ref kind,
|
||||
..
|
||||
}) = definitions.first()
|
||||
{
|
||||
if let Some(WhereDefinition { ref kind_span, ref kind, .. }) = definitions.first() {
|
||||
let msg = format!(
|
||||
"`{:?}` was declared above. Please use exactly one declaration for `{:?}`.",
|
||||
kind, kind
|
||||
);
|
||||
return Err(Error::new(*kind_span, msg));
|
||||
return Err(Error::new(*kind_span, msg))
|
||||
}
|
||||
Ok(Self {
|
||||
block,
|
||||
node_block,
|
||||
unchecked_extrinsic,
|
||||
})
|
||||
Ok(Self { block, node_block, unchecked_extrinsic })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,17 +118,11 @@ impl Parse for WhereDefinition {
|
||||
let (kind_span, kind) = if lookahead.peek(keyword::Block) {
|
||||
(input.parse::<keyword::Block>()?.span(), WhereKind::Block)
|
||||
} else if lookahead.peek(keyword::NodeBlock) {
|
||||
(
|
||||
input.parse::<keyword::NodeBlock>()?.span(),
|
||||
WhereKind::NodeBlock,
|
||||
)
|
||||
(input.parse::<keyword::NodeBlock>()?.span(), WhereKind::NodeBlock)
|
||||
} else if lookahead.peek(keyword::UncheckedExtrinsic) {
|
||||
(
|
||||
input.parse::<keyword::UncheckedExtrinsic>()?.span(),
|
||||
WhereKind::UncheckedExtrinsic,
|
||||
)
|
||||
(input.parse::<keyword::UncheckedExtrinsic>()?.span(), WhereKind::UncheckedExtrinsic)
|
||||
} else {
|
||||
return Err(lookahead.error());
|
||||
return Err(lookahead.error())
|
||||
};
|
||||
|
||||
Ok(Self {
|
||||
@@ -187,13 +172,7 @@ impl Parse for PalletDeclaration {
|
||||
None
|
||||
};
|
||||
|
||||
let parsed = Self {
|
||||
name,
|
||||
path,
|
||||
instance,
|
||||
pallet_parts,
|
||||
index,
|
||||
};
|
||||
let parsed = Self { name, path, instance, pallet_parts, index };
|
||||
|
||||
Ok(parsed)
|
||||
}
|
||||
@@ -214,17 +193,17 @@ impl Parse for PalletPath {
|
||||
let mut lookahead = input.lookahead1();
|
||||
let mut segments = Punctuated::new();
|
||||
|
||||
if lookahead.peek(Token![crate])
|
||||
|| lookahead.peek(Token![self])
|
||||
|| lookahead.peek(Token![super])
|
||||
|| lookahead.peek(Ident)
|
||||
if lookahead.peek(Token![crate]) ||
|
||||
lookahead.peek(Token![self]) ||
|
||||
lookahead.peek(Token![super]) ||
|
||||
lookahead.peek(Ident)
|
||||
{
|
||||
let ident = input.call(Ident::parse_any)?;
|
||||
segments.push(PathSegment { ident, arguments: PathArguments::None });
|
||||
let _: Token![::] = input.parse()?;
|
||||
lookahead = input.lookahead1();
|
||||
} else {
|
||||
return Err(lookahead.error());
|
||||
return Err(lookahead.error())
|
||||
}
|
||||
|
||||
while lookahead.peek(Ident) {
|
||||
@@ -235,15 +214,10 @@ impl Parse for PalletPath {
|
||||
}
|
||||
|
||||
if !lookahead.peek(token::Brace) && !lookahead.peek(Token![<]) {
|
||||
return Err(lookahead.error());
|
||||
return Err(lookahead.error())
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
inner: Path {
|
||||
leading_colon: None,
|
||||
segments,
|
||||
}
|
||||
})
|
||||
Ok(Self { inner: Path { leading_colon: None, segments } })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,7 +231,7 @@ impl quote::ToTokens for PalletPath {
|
||||
///
|
||||
/// `{ Call, Event }`
|
||||
fn parse_pallet_parts(input: ParseStream) -> Result<Vec<PalletPart>> {
|
||||
let pallet_parts :ext::Braces<ext::Punctuated<PalletPart, Token![,]>> = input.parse()?;
|
||||
let pallet_parts: ext::Braces<ext::Punctuated<PalletPart, Token![,]>> = input.parse()?;
|
||||
|
||||
let mut resolved = HashSet::new();
|
||||
for part in pallet_parts.content.inner.iter() {
|
||||
@@ -266,7 +240,7 @@ fn parse_pallet_parts(input: ParseStream) -> Result<Vec<PalletPart>> {
|
||||
"`{}` was already declared before. Please remove the duplicate declaration",
|
||||
part.name(),
|
||||
);
|
||||
return Err(Error::new(part.keyword.span(), msg));
|
||||
return Err(Error::new(part.keyword.span(), msg))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,13 +345,10 @@ impl Parse for PalletPart {
|
||||
keyword.name(),
|
||||
valid_generics,
|
||||
);
|
||||
return Err(syn::Error::new(keyword.span(), msg));
|
||||
return Err(syn::Error::new(keyword.span(), msg))
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
keyword,
|
||||
generics,
|
||||
})
|
||||
Ok(Self { keyword, generics })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user