File tree 3 files changed +6
-12
lines changed
rustfmt-core/rustfmt-lib/src
3 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -281,9 +281,7 @@ impl<'a> FnSig<'a> {
281
281
visit:: FnKind :: Method ( _, method_sig, vis, _) => {
282
282
let mut fn_sig = FnSig :: from_method_sig ( method_sig, generics) ;
283
283
fn_sig. defaultness = defaultness;
284
- if let Some ( vis) = vis {
285
- fn_sig. visibility = vis. clone ( ) ;
286
- }
284
+ fn_sig. visibility = vis. clone ( ) ;
287
285
fn_sig
288
286
}
289
287
_ => unreachable ! ( ) ,
@@ -1753,7 +1751,7 @@ impl<'a> StaticParts<'a> {
1753
1751
ident : ii. ident ,
1754
1752
ty,
1755
1753
mutability : ast:: Mutability :: Not ,
1756
- expr_opt : Some ( expr) ,
1754
+ expr_opt : expr. as_ref ( ) ,
1757
1755
defaultness : Some ( ii. defaultness ) ,
1758
1756
span : ii. span ,
1759
1757
}
Original file line number Diff line number Diff line change @@ -191,8 +191,8 @@ impl Rewrite for Pat {
191
191
infix. to_owned ( )
192
192
} ;
193
193
rewrite_pair (
194
- & * * lhs,
195
- & * * rhs,
194
+ & lhs. unwrap ( ) ,
195
+ & rhs. unwrap ( ) ,
196
196
PairParts :: infix ( & infix) ,
197
197
context,
198
198
shape,
Original file line number Diff line number Diff line change 1
1
use std:: iter:: ExactSizeIterator ;
2
2
use std:: ops:: Deref ;
3
3
4
- use rustc_span:: { BytePos , DUMMY_SP , Span , symbol:: kw} ;
4
+ use rustc_span:: { BytePos , Span , symbol:: kw} ;
5
5
use syntax:: ast:: { self , FunctionRetTy , Mutability } ;
6
6
7
7
use crate :: config:: lists:: * ;
@@ -274,13 +274,9 @@ fn rewrite_segment(
274
274
result. push_str ( & generics_str)
275
275
}
276
276
ast:: GenericArgs :: Parenthesized ( ref data) => {
277
- let output = match data. output {
278
- Some ( ref ty) => FunctionRetTy :: Ty ( ty. clone ( ) ) ,
279
- None => FunctionRetTy :: Default ( DUMMY_SP ) ,
280
- } ;
281
277
result. push_str ( & format_function_type (
282
278
data. inputs . iter ( ) . map ( |x| & * * x) ,
283
- & output,
279
+ & data . output ,
284
280
false ,
285
281
data. span ,
286
282
context,
You can’t perform that action at this time.
0 commit comments