Browse Source

Fix clippy 1.78.0 lints (#2971)

acheron 1 năm trước cách đây
mục cha
commit
518b73f219
3 tập tin đã thay đổi với 8 bổ sung8 xóa
  1. 0 1
      cli/Cargo.toml
  2. 7 6
      cli/src/config.rs
  3. 1 1
      spl/src/token_2022_extensions/group_pointer.rs

+ 0 - 1
cli/Cargo.toml

@@ -2,7 +2,6 @@
 name = "anchor-cli"
 version = "0.30.0"
 authors = ["Anchor Maintainers <accounts@200ms.io>"]
-rust-version = "1.60"
 edition = "2021"
 repository = "https://github.com/coral-xyz/anchor"
 description = "Anchor CLI"

+ 7 - 6
cli/src/config.rs

@@ -601,8 +601,8 @@ where
     deserializer.deserialize_any(StringOrCustomCluster(PhantomData))
 }
 
-impl ToString for Config {
-    fn to_string(&self) -> String {
+impl fmt::Display for Config {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         let programs = {
             let c = ser_programs(&self.programs);
             if c.is_empty() {
@@ -629,7 +629,8 @@ impl ToString for Config {
                 .then(|| self.workspace.clone()),
         };
 
-        toml::to_string(&cfg).expect("Must be well formed")
+        let cfg = toml::to_string(&cfg).expect("Must be well formed");
+        write!(f, "{}", cfg)
     }
 }
 
@@ -1395,9 +1396,9 @@ macro_rules! home_path {
             }
         }
 
-        impl ToString for $my_struct {
-            fn to_string(&self) -> String {
-                self.0.clone()
+        impl fmt::Display for $my_struct {
+            fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+                write!(f, "{}", self.0)
             }
         }
     };

+ 1 - 1
spl/src/token_2022_extensions/group_pointer.rs

@@ -36,7 +36,7 @@ pub fn group_pointer_update<'info>(
         ctx.accounts.token_program_id.key,
         ctx.accounts.mint.key,
         ctx.accounts.authority.key,
-        &[&ctx.accounts.authority.key],
+        &[ctx.accounts.authority.key],
         group_address,
     )?;
     anchor_lang::solana_program::program::invoke_signed(