File tree Expand file tree Collapse file tree 5 files changed +13
-14
lines changed Expand file tree Collapse file tree 5 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ pub(crate) struct MaybeOwnedArc<T>(
123123#[ cfg( feature = "temp_cache" ) ]
124124impl < T > MaybeOwnedArc < T > {
125125 pub ( crate ) fn new ( inner : T ) -> Self {
126- Self ( Arc :: new ( inner) . into ( ) )
126+ Self ( Arc :: new ( inner) )
127127 }
128128
129129 pub ( crate ) fn get_inner ( self ) -> Arc < T > {
@@ -159,6 +159,6 @@ impl<T> std::ops::Deref for MaybeOwnedArc<T> {
159159#[ cfg( feature = "temp_cache" ) ]
160160impl < T > Clone for MaybeOwnedArc < T > {
161161 fn clone ( & self ) -> Self {
162- Self ( self . 0 . clone ( ) . into ( ) )
162+ Self ( Arc :: clone ( & self . 0 ) )
163163 }
164164}
Original file line number Diff line number Diff line change @@ -55,8 +55,7 @@ impl ChannelId {
5555 guild_id : Option < GuildId > ,
5656 ) -> Result < GuildChannel > {
5757 #[ cfg( feature = "cache" ) ]
58- // Ignore clippy, the two `if let`s must be separated
59- #[ expect( clippy:: collapsible_if) ]
58+ #[ cfg_attr( not( feature = "temp_cache" ) , expect( clippy:: collapsible_if) ) ]
6059 if let Some ( cache) = cache_http. cache ( ) {
6160 if let Some ( guild_id) = guild_id
6261 && let Some ( guild) = cache. guild ( guild_id)
Original file line number Diff line number Diff line change @@ -191,6 +191,7 @@ impl Channel {
191191 }
192192
193193 /// If this is a guild channel or guild thread, returns the corresponding guild's Id.
194+ #[ must_use]
194195 pub fn guild_id ( & self ) -> Option < GuildId > {
195196 match self {
196197 Channel :: GuildThread ( thread) => Some ( thread. base . guild_id ) ,
Original file line number Diff line number Diff line change @@ -33,8 +33,7 @@ impl ThreadId {
3333 guild_id : Option < GuildId > ,
3434 ) -> Result < GuildThread > {
3535 #[ cfg( feature = "cache" ) ]
36- // Ignore clippy, the two `if let`s must be separated
37- #[ expect( clippy:: collapsible_if) ]
36+ #[ cfg_attr( not( feature = "temp_cache" ) , expect( clippy:: collapsible_if) ) ]
3837 if let Some ( cache) = cache_http. cache ( ) {
3938 if let Some ( guild_id) = guild_id
4039 && let Some ( guild) = cache. guild ( guild_id)
Original file line number Diff line number Diff line change @@ -552,10 +552,10 @@ impl UserId {
552552 }
553553
554554 #[ cfg( feature = "temp_cache" ) ]
555- if let Some ( cache) = cache_http. cache ( ) {
556- if let Some ( private_channel) = cache. temp_private_channels . get ( & self ) {
557- return Ok ( PrivateChannel :: clone ( & private_channel ) ) ;
558- }
555+ if let Some ( cache) = cache_http. cache ( )
556+ && let Some ( private_channel) = cache. temp_private_channels . get ( & self )
557+ {
558+ return Ok ( PrivateChannel :: clone ( & private_channel ) ) ;
559559 }
560560
561561 let body = CreateDmChannel {
@@ -641,10 +641,10 @@ impl UserId {
641641 pub async fn to_user ( self , cache_http : impl CacheHttp ) -> Result < User > {
642642 #[ cfg( feature = "temp_cache" ) ]
643643 {
644- if let Some ( cache) = cache_http. cache ( ) {
645- if let Some ( user) = cache. temp_users . get ( & self ) {
646- return Ok ( User :: clone ( & user ) ) ;
647- }
644+ if let Some ( cache) = cache_http. cache ( )
645+ && let Some ( user) = cache. temp_users . get ( & self )
646+ {
647+ return Ok ( User :: clone ( & user ) ) ;
648648 }
649649 }
650650
You can’t perform that action at this time.
0 commit comments