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 @@ -655,10 +655,10 @@ impl UserId {
655655 }
656656
657657 #[ cfg( feature = "temp_cache" ) ]
658- if let Some ( cache) = cache_http. cache ( ) {
659- if let Some ( private_channel) = cache. temp_private_channels . get ( & self ) {
660- return Ok ( PrivateChannel :: clone ( & private_channel ) ) ;
661- }
658+ if let Some ( cache) = cache_http. cache ( )
659+ && let Some ( private_channel) = cache. temp_private_channels . get ( & self )
660+ {
661+ return Ok ( PrivateChannel :: clone ( & private_channel ) ) ;
662662 }
663663
664664 let body = CreateDmChannel {
@@ -744,10 +744,10 @@ impl UserId {
744744 pub async fn to_user ( self , cache_http : impl CacheHttp ) -> Result < User > {
745745 #[ cfg( feature = "temp_cache" ) ]
746746 {
747- if let Some ( cache) = cache_http. cache ( ) {
748- if let Some ( user) = cache. temp_users . get ( & self ) {
749- return Ok ( User :: clone ( & user ) ) ;
750- }
747+ if let Some ( cache) = cache_http. cache ( )
748+ && let Some ( user) = cache. temp_users . get ( & self )
749+ {
750+ return Ok ( User :: clone ( & user ) ) ;
751751 }
752752 }
753753
You can’t perform that action at this time.
0 commit comments