Skip to content

Commit cd6b5a8

Browse files
author
karroffel
committed
make clippy happy
1 parent 56886a0 commit cd6b5a8

File tree

5 files changed

+12
-23
lines changed

5 files changed

+12
-23
lines changed

src/implementation/codegen.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ pub(crate) fn generate(
244244
make_assertion(
245245
mode,
246246
ContractType::Requires,
247-
display.clone().into(),
247+
display.clone(),
248248
expr,
249249
&desc.clone(),
250250
)
@@ -282,7 +282,7 @@ pub(crate) fn generate(
282282
make_assertion(
283283
mode,
284284
ContractType::Ensures,
285-
display.clone().into(),
285+
display.clone(),
286286
expr,
287287
&desc.clone(),
288288
)
@@ -369,7 +369,5 @@ pub(crate) fn generate(
369369

370370
func.function.block = Box::new(syn::parse_quote!(#new_block));
371371

372-
let res = func.function.into_token_stream();
373-
374-
res.into()
372+
func.function.into_token_stream()
375373
}

src/implementation/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub(crate) fn generate_attributes(contracts: &[Contract]) -> Vec<Attribute> {
1616
let content_str = syn::LitStr::new(content, span);
1717

1818
let toks: TokenStream =
19-
quote::quote_spanned!( span=> #[doc = #content_str] ).into();
19+
quote::quote_spanned!( span=> #[doc = #content_str] );
2020

2121
let parser = Attribute::parse_outer;
2222

src/implementation/invariant.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

55
use proc_macro2::TokenStream;
6+
use quote::ToTokens;
67
use syn::{FnArg, ImplItem, ImplItemMethod, Item, ItemFn, ItemImpl};
78

89
use crate::implementation::{ContractMode, ContractType, FuncWithContracts};
@@ -54,23 +55,18 @@ fn invariant_impl(
5455
let name = match mode.name() {
5556
Some(n) => n.to_string() + "invariant",
5657
None => {
57-
return quote::quote!( #impl_def ).into();
58+
return quote::quote!( #impl_def );
5859
}
5960
};
6061

6162
let invariant_ident =
6263
syn::Ident::new(&name, proc_macro2::Span::call_site());
6364

64-
let invariant: proc_macro2::TokenStream = invariant.into();
65-
6665
fn method_uses_self(method: &ImplItemMethod) -> bool {
6766
let inputs = &method.sig.inputs;
6867

6968
if !inputs.is_empty() {
70-
match inputs[0] {
71-
FnArg::Receiver(_) => true,
72-
_ => false,
73-
}
69+
matches!(inputs[0], FnArg::Receiver(_))
7470
} else {
7571
false
7672
}
@@ -94,8 +90,5 @@ fn invariant_impl(
9490
}
9591
}
9692

97-
let toks = quote::quote! {
98-
#impl_def
99-
};
100-
toks.into()
93+
impl_def.into_token_stream()
10194
}

src/implementation/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ impl FuncWithContracts {
203203
TokenTree::Literal(l) => l.into_token_stream(),
204204
};
205205

206-
Contract::from_toks(ty, mode, toks.into())
206+
Contract::from_toks(ty, mode, toks)
207207
});
208208

209209
contracts.extend(contract_attrs);

src/implementation/parse.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use syn::{Expr, ExprLit, Lit};
1010
pub(crate) fn parse_attributes(
1111
attrs: TokenStream,
1212
) -> (Vec<Expr>, Vec<TokenStream>, Option<String>) {
13-
let segments = segment_input(attrs.into());
13+
let segments = segment_input(attrs);
1414
let mut segments_stream: Vec<TokenStream> = segments
1515
.iter()
1616
.map(|x| x.iter().cloned().collect::<TokenStream>())
@@ -42,9 +42,7 @@ pub(crate) fn parse_attributes(
4242
segments_stream.pop();
4343
}
4444

45-
let exprs = conds.into_iter().map(|e| e).collect();
46-
47-
(exprs, segments_stream, desc)
45+
(conds, segments_stream, desc)
4846
}
4947

5048
// This function rewrites a list of TokenTrees so that the "pseudooperator" for
@@ -156,7 +154,7 @@ fn rewrite(segments: Vec<TokenTree>) -> proc_macro2::TokenStream {
156154

157155
quote::quote_spanned! {
158156
span =>
159-
(!(#lhs) || (#rhs))
157+
(!(#lhs) || #rhs)
160158
}
161159
}
162160
}

0 commit comments

Comments
 (0)