Lucas Nogueira 2 years ago
parent
commit
f7e86798c2

+ 1 - 1
core/config-schema/build.rs

@@ -17,7 +17,7 @@ pub fn main() -> Result<(), Box<dyn Error>> {
     crate_dir.join("schema.json"),
     crate_dir.join("../../tooling/cli/schema.json"),
   ] {
-    let mut schema_file = BufWriter::new(File::create(&file)?);
+    let mut schema_file = BufWriter::new(File::create(file)?);
     write!(schema_file, "{}", schema_str)?;
   }
 

+ 1 - 1
core/tauri-build/src/lib.rs

@@ -72,7 +72,7 @@ fn copy_resources(resources: ResourcePaths<'_>, path: &Path) -> Result<()> {
     let src = src?;
     println!("cargo:rerun-if-changed={}", src.display());
     let dest = path.join(resource_relpath(&src));
-    copy_file(&src, &dest)?;
+    copy_file(&src, dest)?;
   }
   Ok(())
 }

+ 3 - 3
core/tauri-codegen/src/context.rs

@@ -447,13 +447,13 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
         return false;
       }
     }
-    return true;
+    true
   }
 
   fn compare_token_tree(a: TokenTree, b: TokenTree) -> bool {
     match (a, b) {
       (TokenTree::Group(a), TokenTree::Group(b)) => compare_token_stream(a.stream(), b.stream()),
-      (TokenTree::Ident(a), TokenTree::Ident(b)) => a.to_string() == b.to_string(),
+      (TokenTree::Ident(a), TokenTree::Ident(b)) => b == a,
       (TokenTree::Punct(a), TokenTree::Punct(b)) => a.to_string() == b.to_string(),
       (TokenTree::Literal(a), TokenTree::Literal(b)) => a.to_string() == b.to_string(),
       _ => false,
@@ -513,7 +513,7 @@ pub fn context_codegen(data: ContextData) -> Result<TokenStream, EmbeddedAssetsE
     #shell_scope_config
   ));
 
-  if compare_token_stream(root.clone(), quote!(crate)) {
+  if compare_token_stream(root, quote!(crate)) {
     let mut stream = TokenStream::new();
     let mut ignore = false;
     let mut previous_token = None;

+ 2 - 2
core/tauri/build.rs

@@ -136,8 +136,8 @@ fn main() {
   let checked_features_out_path =
     Path::new(&std::env::var("OUT_DIR").unwrap()).join("checked_features");
   std::fs::write(
-    &checked_features_out_path,
-    &CHECKED_FEATURES.get().unwrap().lock().unwrap().join(","),
+    checked_features_out_path,
+    CHECKED_FEATURES.get().unwrap().lock().unwrap().join(","),
   )
   .expect("failed to write checked_features file");
 }

+ 1 - 1
core/tauri/src/api/file/extract.rs

@@ -245,7 +245,7 @@ impl<'a, R: Read + Seek> Extract<'a, R> {
             // such as: 爱交易.app/, that does not work as expected.
             // Here we require the file name must be a valid UTF-8.
             let file_name = String::from_utf8(file.name_raw().to_vec())?;
-            let out_path = into_dir.join(&file_name);
+            let out_path = into_dir.join(file_name);
             if file.is_dir() {
               fs::create_dir_all(&out_path)?;
             } else {

+ 2 - 2
core/tauri/src/api/http.rs

@@ -368,7 +368,7 @@ impl TryFrom<FilePart> for Vec<u8> {
   type Error = crate::api::Error;
   fn try_from(file: FilePart) -> crate::api::Result<Self> {
     let bytes = match file {
-      FilePart::Path(path) => std::fs::read(&path)?,
+      FilePart::Path(path) => std::fs::read(path)?,
       FilePart::Contents(bytes) => bytes,
     };
     Ok(bytes)
@@ -662,7 +662,7 @@ impl Response {
     let data = match self.0 {
       ResponseType::Json => self.1.json()?,
       ResponseType::Text => Value::String(self.1.text()?),
-      ResponseType::Binary => serde_json::to_value(&self.1.bytes()?)?,
+      ResponseType::Binary => serde_json::to_value(self.1.bytes()?)?,
     };
 
     Ok(ResponseData {

+ 1 - 3
core/tauri/src/lib.rs

@@ -902,9 +902,7 @@ mod tests {
       // we assume that module features are the ones that start with `<module>-`
       // though it's not 100% accurate, we have an allowed list to fix it
       let module_features = manifest
-        .features
-        .iter()
-        .map(|(f, _)| f)
+        .features.keys()
         .filter(|f| f.starts_with(&module_prefix));
       for module_feature in module_features {
         assert!(

+ 2 - 2
core/tests/app-updater/tests/update.rs

@@ -55,12 +55,12 @@ fn get_cli_bin_path(cli_dir: &Path, debug: bool) -> Option<PathBuf> {
 }
 
 fn build_app(cli_bin_path: &Path, cwd: &Path, config: &Config, bundle_updater: bool) {
-  let mut command = Command::new(&cli_bin_path);
+  let mut command = Command::new(cli_bin_path);
   command
     .args(["build", "--debug", "--verbose"])
     .arg("--config")
     .arg(serde_json::to_string(config).unwrap())
-    .current_dir(&cwd);
+    .current_dir(cwd);
 
   #[cfg(windows)]
   command.args(["--bundles", "msi"]);