feat: add formatting command to package.json and update pre-commit hook for cargo fmt
This commit is contained in:
@@ -3,14 +3,16 @@
|
|||||||
#pnpm pretty-quick --staged
|
#pnpm pretty-quick --staged
|
||||||
|
|
||||||
# 运行 clippy fmt
|
# 运行 clippy fmt
|
||||||
cargo fmt --manifest-path ./src-tauri/Cargo.toml
|
cd src-tauri
|
||||||
|
cargo fmt
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "rustfmt failed to format the code. Please fix the issues and try again."
|
echo "rustfmt failed to format the code. Please fix the issues and try again."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
cd ..
|
||||||
|
|
||||||
#git add .
|
git add .
|
||||||
|
|
||||||
# 允许提交
|
# 允许提交
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
"release-version": "node scripts/release_version.mjs",
|
"release-version": "node scripts/release_version.mjs",
|
||||||
"release-alpha-version": "node scripts/release-alpha_version.mjs",
|
"release-alpha-version": "node scripts/release-alpha_version.mjs",
|
||||||
"prepare": "husky",
|
"prepare": "husky",
|
||||||
|
"fmt": "cargo fmt --manifest-path ./src-tauri/Cargo.toml",
|
||||||
"clippy": "cargo clippy --manifest-path ./src-tauri/Cargo.toml"
|
"clippy": "cargo clippy --manifest-path ./src-tauri/Cargo.toml"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -58,7 +58,8 @@ impl MihomoManager {
|
|||||||
url: String,
|
url: String,
|
||||||
data: Option<serde_json::Value>,
|
data: Option<serde_json::Value>,
|
||||||
) -> Result<serde_json::Value, String> {
|
) -> Result<serde_json::Value, String> {
|
||||||
let client_response = self.client
|
let client_response = self
|
||||||
|
.client
|
||||||
.request(method.clone(), &url)
|
.request(method.clone(), &url)
|
||||||
.json(&data.unwrap_or(json!({})))
|
.json(&data.unwrap_or(json!({})))
|
||||||
.send()
|
.send()
|
||||||
|
|||||||
@@ -24,5 +24,4 @@ impl Drop for MihomoManager {
|
|||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
println!("Dropping MihomoManager");
|
println!("Dropping MihomoManager");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user