@@ -316,26 +316,14 @@ impl AttrsWithOwner {
316316 let src = it. parent ( ) . child_source ( db) ;
317317 RawAttrs :: from_attrs_owner (
318318 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 ( ) ] ) ,
326320 )
327321 }
328322 GenericParamId :: TypeParamId ( it) => {
329323 let src = it. parent ( ) . child_source ( db) ;
330324 RawAttrs :: from_attrs_owner (
331325 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 ( ) ] ) ,
339327 )
340328 }
341329 GenericParamId :: LifetimeParamId ( it) => {
@@ -414,28 +402,14 @@ impl AttrsWithOwner {
414402 } ,
415403 AttrDefId :: ImplId ( id) => id. lookup ( db) . source ( db) . map ( ast:: AnyHasAttrs :: new) ,
416404 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 ( ) ) ) ,
439413 GenericParamId :: LifetimeParamId ( id) => id
440414 . parent
441415 . child_source ( db)
0 commit comments