@@ -302,11 +302,12 @@ impl CargoTransform {
302302
303303 // Write each unified dependency
304304 for unified in unified_deps {
305- // Use inline table for simple deps, regular table for complex ones (with features)
306- let use_inline_table = unified. features . is_empty ( ) ;
305+ // Use inline table for simple deps and deps with few features
306+ // Use regular table format only for deps with many features (>10) to avoid long lines
307+ let use_inline_table = unified. features . len ( ) <= 10 ;
307308
308309 if use_inline_table {
309- // Simple dependency - use inline table format
310+ // Simple dependency or dependency with few features - use inline table format
310311 let mut dep_table = InlineTable :: new ( ) ;
311312
312313 // INVISIBLE FEATURE: Support workspace member path dependencies
@@ -324,6 +325,15 @@ impl CargoTransform {
324325 dep_table. insert ( "default-features" , Value :: from ( false ) ) ;
325326 }
326327
328+ // Add features if any (inline arrays for <10 features)
329+ if !unified. features . is_empty ( ) {
330+ let mut features_array = Array :: new ( ) ;
331+ for feature in & unified. features {
332+ features_array. push ( feature. as_str ( ) ) ;
333+ }
334+ dep_table. insert ( "features" , Value :: from ( features_array) ) ;
335+ }
336+
327337 // Insert the dependency
328338 workspace_deps. insert ( & unified. name , toml_edit:: Item :: Value ( dep_table. into ( ) ) ) ;
329339
@@ -683,10 +693,10 @@ members = ["crate-a", "crate-b"]
683693
684694 // Verify serde entry structure
685695 let serde_dep = workspace_deps. get ( "serde" ) . unwrap ( ) ;
686- // Dependencies with features use regular table format (not inline)
687- assert ! ( serde_dep. is_table ( ) , "Should be regular table (has features)" ) ;
696+ // Dependencies with few features (≤10) use inline table format
697+ assert ! ( serde_dep. is_inline_table ( ) , "Should be inline table (has ≤10 features)" ) ;
688698
689- let serde_table = serde_dep. as_table ( ) . unwrap ( ) ;
699+ let serde_table = serde_dep. as_inline_table ( ) . unwrap ( ) ;
690700 assert_eq ! (
691701 serde_table. get( "version" ) . and_then( |v| v. as_str( ) ) ,
692702 Some ( "^1.0" ) ,
@@ -771,8 +781,8 @@ members = ["crate-a"]
771781 let content = std:: fs:: read_to_string ( temp_file. path ( ) ) . unwrap ( ) ;
772782 let doc: DocumentMut = content. parse ( ) . unwrap ( ) ;
773783
774- // Dependencies with features use regular table format
775- let tokio_dep = doc[ "workspace" ] [ "dependencies" ] [ "tokio" ] . as_table ( ) . unwrap ( ) ;
784+ // Dependencies with ≤10 features use inline table format
785+ let tokio_dep = doc[ "workspace" ] [ "dependencies" ] [ "tokio" ] . as_inline_table ( ) . unwrap ( ) ;
776786 assert_eq ! (
777787 tokio_dep. get( "default-features" ) . and_then( |v| v. as_bool( ) ) ,
778788 Some ( false ) ,
0 commit comments