Parcourir la source

修复代码缺陷

john il y a 1 an
Parent
commit
9c0a3b2279

+ 0 - 1
src-tauri/src/common/sqlite/migration/mod.rs

@@ -1,5 +1,4 @@
 mod database_version;
 
-pub use database_version::*;
 
 

+ 2 - 3
src-tauri/src/common/sqlite/rusqlite_utils.rs

@@ -5,11 +5,10 @@ use rusqlite::{
     types::ValueRef::{Blob, Integer, Null, Real, Text}, // SQLite 值引用类型
     Connection,
     Params,
-    Row,
-    ToSql, // 引入 SQLite 连接、参数、行和 ToSql 类型
+    Row, // 引入 SQLite 连接、参数、行和 ToSql 类型
 };
 use serde_json::{Number, Value}; // 引入 JSON 处理库
-use std::{collections::HashMap, sync::Mutex}; // 引入 HashMap 和 Mutex
+use std::{collections::HashMap}; // 引入 HashMap 和 Mutex
 
 // 查询单个值
 pub fn query_one_value<P, V>(connection: &Connection, sql: &str, p: P) -> Result<V>

+ 9 - 10
src-tauri/src/event_loop.rs

@@ -77,7 +77,6 @@ pub fn file_path(name: &str, parentid: &str) -> String {
 
 use sha2::{Digest, Sha256};
 use std::{fs, io};
-use tauri::api::http::FormPart::File;
 
 #[derive(Debug)]
 struct UseHashInfoStruct {
@@ -108,7 +107,7 @@ fn get_file_hase(path: &str) -> UseHashInfoStruct {
 
 fn read_file(path: &str) -> io::Result<Vec<u8>> {
     use std::fs::File;
-    use std::io::{self, Read};
+    use std::io::{Read};
     let mut file = File::open(path)?;
     let mut bytes = Vec::new();
     file.read_to_end(&mut bytes)?;
@@ -119,7 +118,7 @@ fn read_file(path: &str) -> io::Result<Vec<u8>> {
 
 fn create_file(path: &str, buf: &str) -> io::Result<()> {
     use std::fs::File;
-    use std::io::{self, Write};
+    use std::io::{Write};
     let mut file = File::create(path)?;
     // let file_byts = read_file("/Users/sysadmin/Downloads/文件相似度对比_new.pdf")?;
     file.write_all(buf.as_bytes())?;
@@ -138,11 +137,11 @@ fn jaccard(str1: &str, str2: &str) -> f64 {
 #[tauri::command(name = "file_sort")]
 // pub fn file_sort(path: &str) -> String {
 pub fn file_sort(path: &str)  {
-    use file_diff::{diff_files};
-    use std::io;
-    use std::io::prelude::*;
-    use std::fs::File;
-    use strsim::damerau_levenshtein;
+    
+    
+    
+    
+    
 
     // use strsim::{jaccard};
     let hash_info = get_file_hase(&path);
@@ -158,11 +157,11 @@ pub fn file_sort(path: &str)  {
     // let n1 = f1.read(&mut buffer[..]).unwrap();
     // let n2 = f2.read(&mut buffer[..]).unwrap();
     let bytes = read_file("/Users/sysadmin/Downloads/文件相似度对比_old.pdf").unwrap();
-    let mut bytes_str = format!("{:?}", bytes);
+    let bytes_str = format!("{:?}", bytes);
     // create_file("/Users/sysadmin/Downloads/文件相似度对比_old.md", &bytes_str);
     // let bytes2 = read_file("/Users/sysadmin/Downloads/文件相似度对比_new.pdf").unwrap();
     let bytes2 = read_file("/Users/sysadmin/Downloads/截屏2022-11-30 上午10.00.17 2.png").unwrap();
-    let mut  bytes2_str = format!("{:?}", bytes2);
+    let bytes2_str = format!("{:?}", bytes2);
     // create_file("/Users/sysadmin/Downloads/文件相似度对比_new.md", &bytes2_str);
 
 

+ 0 - 1
src-tauri/src/self_plugin/tauri_plugin_file/files.rs

@@ -1,4 +1,3 @@
-use std::collections::HashSet;
 use std::fs;
 // use crypto::digest::Digest;
 // use crypto::sha2::Sha256;

+ 1 - 2
src-tauri/src/self_plugin/tauri_plugin_file/mod.rs

@@ -1,8 +1,7 @@
 pub(crate) mod files;
 
 use tauri::{
-    plugin::{Builder, TauriPlugin},
-    Manager, Runtime,
+    plugin::{Builder, TauriPlugin}, Runtime,
 };
 
 use self::files::*;

+ 1 - 2
src-tauri/src/self_plugin/tauri_plugin_sqlite/mod.rs

@@ -2,8 +2,7 @@ pub(crate) mod sqlite;
 //  as tauri_plugin_sqlite;
 
 use tauri::{
-    plugin::{Builder, TauriPlugin},
-    Manager, Runtime,
+    plugin::{Builder, TauriPlugin}, Runtime,
 };
 
 use self::sqlite::*;