@@ -315,26 +315,14 @@ impl AttrsWithOwner {
315315 let src = it. parent ( ) . child_source ( db) ;
316316 RawAttrs :: from_attrs_owner (
317317 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 ( ) ] ) ,
325319 )
326320 }
327321 GenericParamId :: TypeParamId ( it) => {
328322 let src = it. parent ( ) . child_source ( db) ;
329323 RawAttrs :: from_attrs_owner (
330324 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 ( ) ] ) ,
338326 )
339327 }
340328 GenericParamId :: LifetimeParamId ( it) => {
@@ -412,28 +400,14 @@ impl AttrsWithOwner {
412400 } ,
413401 AttrDefId :: ImplId ( id) => id. lookup ( db) . source ( db) . map ( ast:: AnyHasAttrs :: new) ,
414402 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 ( ) ) ) ,
437411 GenericParamId :: LifetimeParamId ( id) => id
438412 . parent
439413 . child_source ( db)
0 commit comments