소스 검색

cargo clippy fix for Data

Mostly use matches! macro instead of match... I think this really means the same thing... but it does make things cleaner... ish. maybe.
david 2 달 전
부모
커밋
6dc644bb52
1개의 변경된 파일6개의 추가작업 그리고 7개의 파일을 삭제
  1. 6 7
      src/data.rs

+ 6 - 7
src/data.rs

@@ -1,5 +1,4 @@
 use std::{collections::HashMap, fmt::Display};
-use tokio::select;
 
 use crate::Shared;
 
@@ -34,7 +33,7 @@ impl Display for Data {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
         match self {
             Self::None => f.write_str("None"),
-            Self::String(s) => f.write_str(&s),
+            Self::String(s) => f.write_str(s),
             Self::I8(i) => f.write_str(format!("{}", i).as_str()),
             Self::I16(i) => f.write_str(format!("{}", i).as_str()),
             Self::I32(i) => f.write_str(format!("{}", i).as_str()),
@@ -56,7 +55,7 @@ impl Display for Data {
                     }
                     out.push_str(format!("{}", d).as_str());
                 }
-                out.push_str("]");
+                out.push(']');
                 f.write_str(out.as_str())
             },
             Self::HashMap(hm) => {
@@ -67,7 +66,7 @@ impl Display for Data {
                     }
                     out.push_str(format!("{}: {}", k, v).as_str());
                 }
-                out.push_str("}");
+                out.push('}');
                 f.write_str(out.as_str())
             },
         }
@@ -330,9 +329,9 @@ impl TryInto<HashMap<String, Data>> for Data {
     }
 }
 
-impl Into<Shared<Data>> for Data {
-    fn into(self) -> Shared<Data> {
-        Shared::new(self)
+impl From<Data> for Shared<Data> {
+    fn from(val: Data) -> Self {
+        Shared::new(val)
     }
 }