@@ -206,7 +206,7 @@ impl Callbacks for TimePassesCallbacks {
206
206
// time because it will mess up the --print output. See #64339.
207
207
//
208
208
self . time_passes = ( config. opts. prints. is_empty( ) && config. opts. unstable_opts. time_passes)
209
- . then ( || config. opts. unstable_opts. time_passes_format) ;
209
+ . then_some ( config. opts. unstable_opts. time_passes_format) ;
210
210
config. opts. trimmed_def_paths = true ;
211
211
}
212
212
}
@@ -439,8 +439,9 @@ fn make_input(early_dcx: &EarlyDiagCtxt, free_matches: &[String]) -> Option<Inpu
439
439
"when UNSTABLE_RUSTDOC_TEST_PATH is set \
440
440
UNSTABLE_RUSTDOC_TEST_LINE also needs to be set",
441
441
) ;
442
- let line = isize :: from_str_radix( & line, 10 )
443
- . expect( "UNSTABLE_RUSTDOC_TEST_LINE needs to be an number" ) ;
442
+ let line = line
443
+ . parse:: <isize >( )
444
+ . expect( "UNSTABLE_RUSTDOC_TEST_LINE needs to be a number" ) ;
444
445
FileName :: doc_test_source_code( PathBuf :: from( path) , line)
445
446
}
446
447
Err ( _) => FileName :: anon_source_code( & input) ,
@@ -474,8 +475,7 @@ fn handle_explain(early_dcx: &EarlyDiagCtxt, registry: Registry, code: &str, col
474
475
let mut text = String :: new( ) ;
475
476
// Slice off the leading newline and print.
476
477
for line in description. lines( ) {
477
- let indent_level =
478
- line. find( |c: char | !c. is_whitespace( ) ) . unwrap_or_else( || line. len( ) ) ;
478
+ let indent_level = line. find( |c: char | !c. is_whitespace( ) ) . unwrap_or( line. len( ) ) ;
479
479
let dedented_line = & line[ indent_level..] ;
480
480
if dedented_line. starts_with( "```" ) {
481
481
is_in_code_block = !is_in_code_block;
@@ -547,7 +547,7 @@ fn show_md_content_with_pager(content: &str, color: ColorConfig) {
547
547
548
548
// The pager failed. Try to print pretty output to stdout.
549
549
if let Some ( ( bufwtr, mdbuf) ) = & pretty_data
550
- && bufwtr. print( & mdbuf) . is_ok( )
550
+ && bufwtr. print( mdbuf) . is_ok( )
551
551
{
552
552
return ;
553
553
}
@@ -598,8 +598,7 @@ fn process_rlink(sess: &Session, compiler: &interface::Compiler) {
598
598
599
599
fn list_metadata( sess: & Session , metadata_loader: & dyn MetadataLoader ) {
600
600
match sess. io. input {
601
- Input :: File ( ref ifile) => {
602
- let path = & ( * ifile) ;
601
+ Input :: File ( ref path) => {
603
602
let mut v = Vec :: new( ) ;
604
603
locator:: list_file_metadata(
605
604
& sess. target,
@@ -833,7 +832,7 @@ fn print_crate_info(
833
832
SupportedCrateTypes => {
834
833
let supported_crate_types = CRATE_TYPES
835
834
. iter( )
836
- . filter( |( _, crate_type) | !invalid_output_for_target( & sess, * crate_type) )
835
+ . filter( |( _, crate_type) | !invalid_output_for_target( sess, * crate_type) )
837
836
. filter( |( _, crate_type) | * crate_type != CrateType :: Sdylib )
838
837
. map( |( crate_type_sym, _) | * crate_type_sym)
839
838
. collect:: <BTreeSet <_>>( ) ;
@@ -1434,7 +1433,7 @@ pub fn install_ice_hook(bug_report_url: &'static str, extra_info: fn(&DiagCtxt))
1434
1433
eprintln!( ) ;
1435
1434
1436
1435
if let Some ( ice_path) = ice_path( )
1437
- && let Ok ( mut out) = File :: options( ) . create( true ) . append( true ) . open( & ice_path)
1436
+ && let Ok ( mut out) = File :: options( ) . create( true ) . append( true ) . open( ice_path)
1438
1437
{
1439
1438
// The current implementation always returns `Some`.
1440
1439
let location = info. location( ) . unwrap( ) ;
@@ -1510,7 +1509,7 @@ fn report_ice(
1510
1509
1511
1510
let file = if let Some ( path) = ice_path( ) {
1512
1511
// Create the ICE dump target file.
1513
- match crate :: fs:: File :: options( ) . create( true ) . append( true ) . open( & path) {
1512
+ match crate :: fs:: File :: options( ) . create( true ) . append( true ) . open( path) {
1514
1513
Ok ( mut file) => {
1515
1514
dcx. emit_note( session_diagnostics:: IcePath { path: path. clone( ) } ) ;
1516
1515
if FIRST_PANIC . swap( false , Ordering :: SeqCst ) {
0 commit comments