@@ -968,8 +968,6 @@ macro_rules! try_or_def {
968
968
} ;
969
969
}
970
970
971
- type ParallelCachePrimingNumThreads = u8 ;
972
-
973
971
#[ derive( Debug , Clone , Eq , PartialEq ) ]
974
972
pub enum LinkedProject {
975
973
ProjectManifest ( ProjectManifest ) ,
@@ -2205,51 +2203,6 @@ macro_rules! create_bool_or_string_serde {
2205
2203
create_bool_or_string_serde ! ( true_or_always<true , "always" >) ;
2206
2204
create_bool_or_string_serde ! ( false_or_never<false , "never" >) ;
2207
2205
2208
- macro_rules! named_unit_variant {
2209
- ( $variant: ident) => {
2210
- pub ( super ) mod $variant {
2211
- pub ( in super :: super ) fn deserialize<' de, D >( deserializer: D ) -> Result <( ) , D :: Error >
2212
- where
2213
- D : serde:: Deserializer <' de>,
2214
- {
2215
- struct V ;
2216
- impl <' de> serde:: de:: Visitor <' de> for V {
2217
- type Value = ( ) ;
2218
- fn expecting( & self , f: & mut std:: fmt:: Formatter <' _>) -> std:: fmt:: Result {
2219
- f. write_str( concat!( "\" " , stringify!( $variant) , "\" " ) )
2220
- }
2221
- fn visit_str<E : serde:: de:: Error >( self , value: & str ) -> Result <Self :: Value , E > {
2222
- if value == stringify!( $variant) {
2223
- Ok ( ( ) )
2224
- } else {
2225
- Err ( E :: invalid_value( serde:: de:: Unexpected :: Str ( value) , & self ) )
2226
- }
2227
- }
2228
- }
2229
- deserializer. deserialize_str( V )
2230
- }
2231
- pub ( in super :: super ) fn serialize<S >( serializer: S ) -> Result <S :: Ok , S :: Error >
2232
- where
2233
- S : serde:: Serializer ,
2234
- {
2235
- serializer. serialize_str( stringify!( $variant) )
2236
- }
2237
- }
2238
- } ;
2239
- }
2240
-
2241
- mod unit_v {
2242
- named_unit_variant ! ( all) ;
2243
- named_unit_variant ! ( skip_trivial) ;
2244
- named_unit_variant ! ( mutable) ;
2245
- named_unit_variant ! ( reborrow) ;
2246
- named_unit_variant ! ( fieldless) ;
2247
- named_unit_variant ! ( with_block) ;
2248
- named_unit_variant ! ( decimal) ;
2249
- named_unit_variant ! ( hexadecimal) ;
2250
- named_unit_variant ! ( both) ;
2251
- }
2252
-
2253
2206
#[ derive( Serialize , Deserialize , Debug , Clone , Copy , PartialEq ) ]
2254
2207
#[ serde( rename_all = "snake_case" ) ]
2255
2208
#[ derive( Default ) ]
@@ -2364,10 +2317,10 @@ pub(crate) enum CallableCompletionDef {
2364
2317
}
2365
2318
2366
2319
#[ derive( Serialize , Deserialize , Debug , Clone ) ]
2367
- #[ serde( untagged ) ]
2320
+ #[ serde( rename_all = "snake_case" ) ]
2368
2321
enum CargoFeaturesDef {
2369
- #[ serde( with = "unit_v::all" ) ]
2370
2322
All ,
2323
+ #[ serde( untagged) ]
2371
2324
Selected ( Vec < String > ) ,
2372
2325
}
2373
2326
@@ -2389,25 +2342,27 @@ enum InvocationLocation {
2389
2342
}
2390
2343
2391
2344
#[ derive( Serialize , Deserialize , Debug , Clone ) ]
2392
- #[ serde( untagged ) ]
2345
+ #[ serde( rename_all = "snake_case" ) ]
2393
2346
enum LifetimeElisionDef {
2347
+ SkipTrivial ,
2394
2348
#[ serde( with = "true_or_always" ) ]
2349
+ #[ serde( untagged) ]
2395
2350
Always ,
2396
2351
#[ serde( with = "false_or_never" ) ]
2352
+ #[ serde( untagged) ]
2397
2353
Never ,
2398
- #[ serde( with = "unit_v::skip_trivial" ) ]
2399
- SkipTrivial ,
2400
2354
}
2401
2355
2402
2356
#[ derive( Serialize , Deserialize , Debug , Clone ) ]
2403
- #[ serde( untagged ) ]
2357
+ #[ serde( rename_all = "snake_case" ) ]
2404
2358
enum ClosureReturnTypeHintsDef {
2359
+ WithBlock ,
2405
2360
#[ serde( with = "true_or_always" ) ]
2361
+ #[ serde( untagged) ]
2406
2362
Always ,
2407
2363
#[ serde( with = "false_or_never" ) ]
2364
+ #[ serde( untagged) ]
2408
2365
Never ,
2409
- #[ serde( with = "unit_v::with_block" ) ]
2410
- WithBlock ,
2411
2366
}
2412
2367
2413
2368
#[ derive( Serialize , Deserialize , Debug , Clone ) ]
@@ -2420,36 +2375,39 @@ enum ClosureStyle {
2420
2375
}
2421
2376
2422
2377
#[ derive( Serialize , Deserialize , Debug , Clone ) ]
2423
- #[ serde( untagged ) ]
2378
+ #[ serde( rename_all = "snake_case" ) ]
2424
2379
enum ReborrowHintsDef {
2380
+ Mutable ,
2425
2381
#[ serde( with = "true_or_always" ) ]
2382
+ #[ serde( untagged) ]
2426
2383
Always ,
2427
2384
#[ serde( with = "false_or_never" ) ]
2385
+ #[ serde( untagged) ]
2428
2386
Never ,
2429
- #[ serde( with = "unit_v::mutable" ) ]
2430
- Mutable ,
2431
2387
}
2432
2388
2433
2389
#[ derive( Serialize , Deserialize , Debug , Clone ) ]
2434
- #[ serde( untagged ) ]
2390
+ #[ serde( rename_all = "snake_case" ) ]
2435
2391
enum AdjustmentHintsDef {
2392
+ Reborrow ,
2436
2393
#[ serde( with = "true_or_always" ) ]
2394
+ #[ serde( untagged) ]
2437
2395
Always ,
2438
2396
#[ serde( with = "false_or_never" ) ]
2397
+ #[ serde( untagged) ]
2439
2398
Never ,
2440
- #[ serde( with = "unit_v::reborrow" ) ]
2441
- Reborrow ,
2442
2399
}
2443
2400
2444
2401
#[ derive( Serialize , Deserialize , Debug , Clone ) ]
2445
- #[ serde( untagged ) ]
2402
+ #[ serde( rename_all = "snake_case" ) ]
2446
2403
enum DiscriminantHintsDef {
2404
+ Fieldless ,
2447
2405
#[ serde( with = "true_or_always" ) ]
2406
+ #[ serde( untagged) ]
2448
2407
Always ,
2449
2408
#[ serde( with = "false_or_never" ) ]
2409
+ #[ serde( untagged) ]
2450
2410
Never ,
2451
- #[ serde( with = "unit_v::fieldless" ) ]
2452
- Fieldless ,
2453
2411
}
2454
2412
2455
2413
#[ derive( Serialize , Deserialize , Debug , Clone ) ]
@@ -2473,9 +2431,11 @@ enum FilesWatcherDef {
2473
2431
#[ serde( rename_all = "snake_case" ) ]
2474
2432
enum ImportPrefixDef {
2475
2433
Plain ,
2476
- #[ serde( alias = "self" ) ]
2434
+ #[ serde( rename = "self" ) ]
2435
+ #[ serde( alias = "by_self" ) ]
2477
2436
BySelf ,
2478
- #[ serde( alias = "crate" ) ]
2437
+ #[ serde( rename = "crate" ) ]
2438
+ #[ serde( alias = "by_crate" ) ]
2479
2439
ByCrate ,
2480
2440
}
2481
2441
@@ -2502,13 +2462,9 @@ enum WorkspaceSymbolSearchKindDef {
2502
2462
2503
2463
#[ derive( Serialize , Deserialize , Debug , Copy , Clone , PartialEq ) ]
2504
2464
#[ serde( rename_all = "snake_case" ) ]
2505
- #[ serde( untagged) ]
2506
2465
enum MemoryLayoutHoverRenderKindDef {
2507
- #[ serde( with = "unit_v::decimal" ) ]
2508
2466
Decimal ,
2509
- #[ serde( with = "unit_v::hexadecimal" ) ]
2510
2467
Hexadecimal ,
2511
- #[ serde( with = "unit_v::both" ) ]
2512
2468
Both ,
2513
2469
}
2514
2470
@@ -2533,10 +2489,10 @@ pub enum TargetDirectory {
2533
2489
2534
2490
#[ derive( Serialize , Deserialize , Debug , Clone , PartialEq ) ]
2535
2491
#[ serde( rename_all = "snake_case" ) ]
2536
- #[ serde( untagged) ]
2537
2492
pub enum NumThreads {
2538
2493
Physical ,
2539
2494
Logical ,
2495
+ #[ serde( untagged) ]
2540
2496
Concrete ( usize ) ,
2541
2497
}
2542
2498
@@ -2792,6 +2748,10 @@ impl FullConfigInput {
2792
2748
ClientConfigInput :: schema_fields ( & mut fields) ;
2793
2749
fields. sort_by_key ( |& ( x, ..) | x) ;
2794
2750
fields
2751
+ . iter ( )
2752
+ . tuple_windows ( )
2753
+ . for_each ( |( a, b) | assert ! ( a. 0 != b. 0 , "{a:?} duplicate field" ) ) ;
2754
+ fields
2795
2755
}
2796
2756
2797
2757
fn json_schema ( ) -> serde_json:: Value {
@@ -3050,11 +3010,6 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
3050
3010
"Search for all symbols kinds."
3051
3011
] ,
3052
3012
} ,
3053
- "ParallelCachePrimingNumThreads" => set ! {
3054
- "type" : "number" ,
3055
- "minimum" : 0 ,
3056
- "maximum" : 255
3057
- } ,
3058
3013
"LifetimeElisionDef" => set ! {
3059
3014
"type" : "string" ,
3060
3015
"enum" : [
@@ -3276,13 +3231,32 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
3276
3231
} ,
3277
3232
] ,
3278
3233
} ,
3234
+ "NumThreads" => set ! {
3235
+ "anyOf" : [
3236
+ {
3237
+ "type" : "number" ,
3238
+ "minimum" : 0 ,
3239
+ "maximum" : 255
3240
+ } ,
3241
+ {
3242
+ "type" : "string" ,
3243
+ "enum" : [ "physical" , "logical" , ] ,
3244
+ "enumDescriptions" : [
3245
+ "Use the number of physical cores" ,
3246
+ "Use the number of logical cores" ,
3247
+ ] ,
3248
+ } ,
3249
+ ] ,
3250
+ } ,
3279
3251
"Option<NumThreads>" => set ! {
3280
3252
"anyOf" : [
3281
3253
{
3282
3254
"type" : "null"
3283
3255
} ,
3284
3256
{
3285
- "type" : "number"
3257
+ "type" : "number" ,
3258
+ "minimum" : 0 ,
3259
+ "maximum" : 255
3286
3260
} ,
3287
3261
{
3288
3262
"type" : "string" ,
@@ -3294,7 +3268,7 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
3294
3268
} ,
3295
3269
] ,
3296
3270
} ,
3297
- _ => panic ! ( "missing entry for {ty}: {default}" ) ,
3271
+ _ => panic ! ( "missing entry for {ty}: {default} (field {field}) " ) ,
3298
3272
}
3299
3273
3300
3274
map. into ( )
@@ -3375,7 +3349,7 @@ mod tests {
3375
3349
. trim_start_matches ( '[' )
3376
3350
. trim_end_matches ( ']' )
3377
3351
. replace ( " " , " " )
3378
- . replace ( '\n' , "\n " )
3352
+ . replace ( '\n' , "\n " )
3379
3353
. trim_start_matches ( '\n' )
3380
3354
. trim_end ( )
3381
3355
. to_owned ( ) ;
0 commit comments