ci: run rust clippy/fmt (#207)

This commit is contained in:
QP Hou
2025-01-20 22:20:26 -08:00
committed by GitHub
parent a7ba5db830
commit 07116bdae8
6 changed files with 7191 additions and 12 deletions
+22
View File
@@ -6,6 +6,28 @@ permissions:
contents: write
pull-requests: write
jobs:
rust_lint:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-C target-cpu=skylake"
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Install minimal stable with clippy and rustfmt
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
override: true
- name: Install system dependencies
run: sudo apt-get install -y libglib2.0-dev libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev libsoup-3.0-dev
- name: Format
working-directory: apps/readest-app/src-tauri
run: cargo fmt --check
- name: Clippy Check
working-directory: apps/readest-app/src-tauri
run: cargo clippy -- -D warnings
build_web_app:
runs-on: ubuntu-latest
steps:
+3
View File
@@ -35,3 +35,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts
# Rust build
target
Generated
+7153
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -0,0 +1,3 @@
[workspace]
members = ["apps/readest-app/src-tauri"]
resolver = "2"
+5 -6
View File
@@ -18,7 +18,6 @@ use std::path::PathBuf;
use tauri::{command, Window};
use tauri::{AppHandle, Emitter, Manager, Url};
use tauri::{WebviewUrl, WebviewWindowBuilder};
use tauri_plugin_dialog;
use tauri_plugin_fs::FsExt;
use tauri_plugin_oauth::start;
@@ -30,12 +29,12 @@ fn allow_file_in_scopes(app: &AppHandle, files: Vec<PathBuf>) {
let fs_scope = app.fs_scope();
let asset_protocol_scope = app.asset_protocol_scope();
for file in &files {
if let Err(e) = fs_scope.allow_file(&file) {
if let Err(e) = fs_scope.allow_file(file) {
eprintln!("Failed to allow file in fs_scope: {}", e);
} else {
println!("Allowed file in fs_scope: {:?}", file);
}
if let Err(e) = asset_protocol_scope.allow_file(&file) {
if let Err(e) = asset_protocol_scope.allow_file(file) {
eprintln!("Failed to allow file in asset_protocol_scope: {}", e);
} else {
println!("Allowed file in asset_protocol_scope: {:?}", file);
@@ -197,9 +196,9 @@ pub fn run() {
// win.open_devtools();
#[cfg(target_os = "macos")]
menu::setup_macos_menu(&app.handle())?;
menu::setup_macos_menu(app.handle())?;
app.handle().emit("window-ready", {}).unwrap();
app.handle().emit("window-ready", ()).unwrap();
Ok(())
})
@@ -216,7 +215,7 @@ pub fn run() {
.collect::<Vec<_>>();
let app_handler_clone = app_handle.clone();
allow_file_in_scopes(&app_handle, files.clone());
allow_file_in_scopes(app_handle, files.clone());
app_handle.listen("window-ready", move |_| {
println!("Window is ready, proceeding to handle files.");
set_window_open_with_files(&app_handler_clone, files.clone());
@@ -25,7 +25,6 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
setup_traffic_light_positioner(window);
}
});
return;
})
.build()
}
@@ -118,7 +117,7 @@ pub fn setup_traffic_light_positioner<R: Runtime>(window: Window<R>) {
}
extern "C" fn on_window_did_resize<R: Runtime>(this: &Object, _cmd: Sel, notification: id) {
unsafe {
with_window_state(&*this, |state: &mut WindowState<R>| {
with_window_state(this, |state: &mut WindowState<R>| {
let id = state
.window
.ns_window()
@@ -216,7 +215,7 @@ pub fn setup_traffic_light_positioner<R: Runtime>(window: Window<R>) {
notification: id,
) {
unsafe {
with_window_state(&*this, |state: &mut WindowState<R>| {
with_window_state(this, |state: &mut WindowState<R>| {
state
.window
.emit("did-enter-fullscreen", ())
@@ -233,7 +232,7 @@ pub fn setup_traffic_light_positioner<R: Runtime>(window: Window<R>) {
notification: id,
) {
unsafe {
with_window_state(&*this, |state: &mut WindowState<R>| {
with_window_state(this, |state: &mut WindowState<R>| {
state
.window
.emit("will-enter-fullscreen", ())
@@ -250,7 +249,7 @@ pub fn setup_traffic_light_positioner<R: Runtime>(window: Window<R>) {
notification: id,
) {
unsafe {
with_window_state(&*this, |state: &mut WindowState<R>| {
with_window_state(this, |state: &mut WindowState<R>| {
state
.window
.emit("did-exit-fullscreen", ())
@@ -274,7 +273,7 @@ pub fn setup_traffic_light_positioner<R: Runtime>(window: Window<R>) {
notification: id,
) {
unsafe {
with_window_state(&*this, |state: &mut WindowState<R>| {
with_window_state(this, |state: &mut WindowState<R>| {
state
.window
.emit("will-exit-fullscreen", ())