@@ -316,26 +316,14 @@ impl AttrsWithOwner {
316
316
let src = it. parent ( ) . child_source ( db) ;
317
317
RawAttrs :: from_attrs_owner (
318
318
db. upcast ( ) ,
319
- src. with_value ( src. value [ it. local_id ( ) ] . as_ref ( ) . either (
320
- |it| match it {
321
- ast:: TypeOrConstParam :: Type ( it) => it as _ ,
322
- ast:: TypeOrConstParam :: Const ( it) => it as _ ,
323
- } ,
324
- |it| it as _ ,
325
- ) ) ,
319
+ src. with_value ( & src. value [ it. local_id ( ) ] ) ,
326
320
)
327
321
}
328
322
GenericParamId :: TypeParamId ( it) => {
329
323
let src = it. parent ( ) . child_source ( db) ;
330
324
RawAttrs :: from_attrs_owner (
331
325
db. upcast ( ) ,
332
- src. with_value ( src. value [ it. local_id ( ) ] . as_ref ( ) . either (
333
- |it| match it {
334
- ast:: TypeOrConstParam :: Type ( it) => it as _ ,
335
- ast:: TypeOrConstParam :: Const ( it) => it as _ ,
336
- } ,
337
- |it| it as _ ,
338
- ) ) ,
326
+ src. with_value ( & src. value [ it. local_id ( ) ] ) ,
339
327
)
340
328
}
341
329
GenericParamId :: LifetimeParamId ( it) => {
@@ -414,28 +402,14 @@ impl AttrsWithOwner {
414
402
} ,
415
403
AttrDefId :: ImplId ( id) => id. lookup ( db) . source ( db) . map ( ast:: AnyHasAttrs :: new) ,
416
404
AttrDefId :: GenericParamId ( id) => match id {
417
- GenericParamId :: ConstParamId ( id) => {
418
- id. parent ( ) . child_source ( db) . map ( |source| match & source[ id. local_id ( ) ] {
419
- Either :: Left ( ast:: TypeOrConstParam :: Type ( id) ) => {
420
- ast:: AnyHasAttrs :: new ( id. clone ( ) )
421
- }
422
- Either :: Left ( ast:: TypeOrConstParam :: Const ( id) ) => {
423
- ast:: AnyHasAttrs :: new ( id. clone ( ) )
424
- }
425
- Either :: Right ( id) => ast:: AnyHasAttrs :: new ( id. clone ( ) ) ,
426
- } )
427
- }
428
- GenericParamId :: TypeParamId ( id) => {
429
- id. parent ( ) . child_source ( db) . map ( |source| match & source[ id. local_id ( ) ] {
430
- Either :: Left ( ast:: TypeOrConstParam :: Type ( id) ) => {
431
- ast:: AnyHasAttrs :: new ( id. clone ( ) )
432
- }
433
- Either :: Left ( ast:: TypeOrConstParam :: Const ( id) ) => {
434
- ast:: AnyHasAttrs :: new ( id. clone ( ) )
435
- }
436
- Either :: Right ( id) => ast:: AnyHasAttrs :: new ( id. clone ( ) ) ,
437
- } )
438
- }
405
+ GenericParamId :: ConstParamId ( id) => id
406
+ . parent ( )
407
+ . child_source ( db)
408
+ . map ( |source| ast:: AnyHasAttrs :: new ( source[ id. local_id ( ) ] . clone ( ) ) ) ,
409
+ GenericParamId :: TypeParamId ( id) => id
410
+ . parent ( )
411
+ . child_source ( db)
412
+ . map ( |source| ast:: AnyHasAttrs :: new ( source[ id. local_id ( ) ] . clone ( ) ) ) ,
439
413
GenericParamId :: LifetimeParamId ( id) => id
440
414
. parent
441
415
. child_source ( db)
0 commit comments