File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -1788,14 +1788,15 @@ fn run_rustfmt(
17881788 let file_id = from_proto:: file_id ( snap, & text_document. uri ) ?;
17891789 let file = snap. analysis . file_text ( file_id) ?;
17901790
1791- // find the edition of the package the file belongs to
1792- // (if it belongs to multiple we'll just pick the first one and pray)
1793- let edition = snap
1791+ // Determine the edition of the crate the file belongs to (if there's multiple, we pick the
1792+ // highest edition).
1793+ let editions = snap
17941794 . analysis
17951795 . relevant_crates_for ( file_id) ?
17961796 . into_iter ( )
1797- . find_map ( |crate_id| snap. cargo_target_for_crate_root ( crate_id) )
1798- . map ( |( ws, target) | ws[ ws[ target] . package ] . edition ) ;
1797+ . map ( |crate_id| snap. analysis . crate_edition ( crate_id) )
1798+ . collect :: < Result < Vec < _ > , _ > > ( ) ?;
1799+ let edition = editions. iter ( ) . copied ( ) . max ( ) ;
17991800
18001801 let line_index = snap. file_line_index ( file_id) ?;
18011802
You can’t perform that action at this time.
0 commit comments