@@ -22,30 +22,27 @@ pub fn apply_fixes(
2222
2323 for diag in diagnostics {
2424 match & diag. check {
25- CheckKind :: NotInherited => {
25+ CheckKind :: NotInherited | CheckKind :: VersionMismatch => {
2626 let member = diag. member . as_deref ( ) . unwrap_or ( "?" ) ;
2727 let full_path = workspace_root. join ( member) ;
2828 if fix_member_dep ( & full_path, & diag. dependency ) ? {
2929 modified_files. insert ( full_path) ;
3030 fixes_applied += 1 ;
31- actions. push ( format ! (
32- "fixed: `{}` in {} now uses workspace inheritance" ,
33- diag. dependency, member,
34- ) ) ;
35- }
36- }
37- CheckKind :: VersionMismatch => {
38- let member = diag. member . as_deref ( ) . unwrap_or ( "?" ) ;
39- let dep_ver = diag. version . as_deref ( ) . unwrap_or ( "?" ) ;
40- let ws_ver = diag. workspace_version . as_deref ( ) . unwrap_or ( "?" ) ;
41- let full_path = workspace_root. join ( member) ;
42- if fix_member_dep ( & full_path, & diag. dependency ) ? {
43- modified_files. insert ( full_path) ;
44- fixes_applied += 1 ;
45- actions. push ( format ! (
46- "fixed: `{}` in {} changed from {} to {} (workspace version)" ,
47- diag. dependency, member, dep_ver, ws_ver,
48- ) ) ;
31+ let msg = match & diag. check {
32+ CheckKind :: NotInherited => format ! (
33+ "fixed: `{}` in {} now uses workspace inheritance" ,
34+ diag. dependency, member,
35+ ) ,
36+ CheckKind :: VersionMismatch => format ! (
37+ "fixed: `{}` in {} changed from {} to {} (workspace version)" ,
38+ diag. dependency,
39+ member,
40+ diag. version. as_deref( ) . unwrap_or( "?" ) ,
41+ diag. workspace_version. as_deref( ) . unwrap_or( "?" ) ,
42+ ) ,
43+ _ => unreachable ! ( ) ,
44+ } ;
45+ actions. push ( msg) ;
4946 }
5047 }
5148 CheckKind :: PromotionCandidate => {
@@ -283,14 +280,10 @@ mod tests {
283280 use super :: * ;
284281 use crate :: check;
285282 use crate :: workspace:: parse_workspace;
286- use std:: path:: PathBuf ;
287283
288284 fn copy_fixture ( name : & str ) -> tempfile:: TempDir {
289- let fixture_dir = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) )
290- . join ( "tests/fixtures" )
291- . join ( name) ;
292285 let tmp = tempfile:: tempdir ( ) . unwrap ( ) ;
293- copy_dir_recursive ( & fixture_dir , tmp. path ( ) ) ;
286+ copy_dir_recursive ( & crate :: fixture ( name ) , tmp. path ( ) ) ;
294287 tmp
295288 }
296289
0 commit comments