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