File tree 4 files changed +6
-6
lines changed
rustfmt-core/rustfmt-lib/src 4 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
- use std:: cell:: { Ref , RefCell } ;
1
+ use std:: cell:: RefCell ;
2
2
use std:: collections:: { BTreeMap , BTreeSet , HashSet } ;
3
3
use std:: rc:: Rc ;
4
4
@@ -92,8 +92,9 @@ impl FormatReport {
92
92
/// various warnings and errors encountered during formatting.
93
93
//
94
94
// NOTE: Avoid using this method internally: use `format_result_as_rc` instead.
95
- pub fn format_result ( & self ) -> impl Iterator < Item = ( & FileName , & FormatResult ) > {
96
- Ref :: leak ( RefCell :: borrow ( & self . format_result ) ) . iter ( )
95
+ // FIXME(topecongiro): Avoid requiring a mutable reference.
96
+ pub fn format_result ( & mut self ) -> impl Iterator < Item = ( & FileName , & FormatResult ) > {
97
+ Rc :: make_mut ( & mut self . format_result ) . get_mut ( ) . iter ( )
97
98
}
98
99
99
100
pub ( crate ) fn format_result_as_rc ( & self ) -> Rc < RefCell < BTreeMap < FileName , FormatResult > > > {
Original file line number Diff line number Diff line change 1
1
#![ deny( rust_2018_idioms) ]
2
2
#![ warn( unreachable_pub) ]
3
- #![ feature( cell_leak) ]
4
3
5
4
#[ macro_use]
6
5
extern crate lazy_static;
Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ impl ConfigCodeBlock {
186
186
return false ;
187
187
}
188
188
189
- let report = report. unwrap ( ) ;
189
+ let mut report = report. unwrap ( ) ;
190
190
let result = report. format_result ( ) . next ( ) . unwrap ( ) ;
191
191
let text = result. 1 . formatted_text ( ) ;
192
192
!self . formatted_has_diff ( text)
Original file line number Diff line number Diff line change @@ -651,7 +651,7 @@ fn idempotent_check(
651
651
} else {
652
652
read_config ( filename)
653
653
} ;
654
- let format_report = match format_file ( filename, builder, config) {
654
+ let mut format_report = match format_file ( filename, builder, config) {
655
655
Ok ( report) => report,
656
656
Err ( _) => return Err ( IdempotentCheckError :: Parse ) ,
657
657
} ;
You can’t perform that action at this time.
0 commit comments