Skip to content

Commit

Permalink
Merge pull request #361 from cunarist/organize-code
Browse files Browse the repository at this point in the history
Remove linter warnings in wasm and release mode
  • Loading branch information
temeddix authored Jun 9, 2024
2 parents 116af7e + 9112c81 commit 98a8001
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/quality_control.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
code:
name: dart-and-rust-code
runs-on: ubuntu-latest
env:
RUSTFLAGS: -D warnings

steps:
- name: Checkout repository
Expand Down Expand Up @@ -55,11 +57,10 @@ jobs:
- name: Check for any errors
run: |
rustup target add wasm32-unknown-unknown
RUSTFLAGS="-D warnings"
cargo check
cargo check --release
cargo check --target wasm32-unknown-unknown
cargo check --target wasm32-unknown-unknown --release
cargo clippy
cargo clippy --release
cargo clippy --target wasm32-unknown-unknown
cargo clippy --target wasm32-unknown-unknown --release
- name: Analyze code
run: |
Expand Down
3 changes: 1 addition & 2 deletions rust_crate/src/interface_os.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::debug_print;
use allo_isolate::{IntoDart, Isolate, ZeroCopyBuffer};
use backtrace::Backtrace;
use os_thread_local::ThreadLocal;
use std::cell::RefCell;
use std::future::Future;
Expand Down Expand Up @@ -35,7 +34,7 @@ where
#[cfg(debug_assertions)]
{
std::panic::set_hook(Box::new(|panic_info| {
let backtrace = Backtrace::new();
let backtrace = backtrace::Backtrace::new();
debug_print!("A panic occurred in Rust.\n{panic_info}\n{backtrace:?}");
}));
}
Expand Down
3 changes: 1 addition & 2 deletions rust_crate/src/interface_web.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::debug_print;
use js_sys::Uint8Array;
use std::future::Future;
use wasm_bindgen::prelude::*;
Expand All @@ -12,7 +11,7 @@ where
#[cfg(debug_assertions)]
{
std::panic::set_hook(Box::new(|panic_info| {
debug_print!("A panic occurred in Rust.\n{panic_info}");
crate::debug_print!("A panic occurred in Rust.\n{panic_info}");
}));
}

Expand Down
4 changes: 1 addition & 3 deletions rust_crate/src/macros.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::crate_in_macro_def)]

#[macro_export]
/// Writes the interface code
/// needed to communicate with Dart.
Expand All @@ -21,7 +19,7 @@ macro_rules! write_interface {

#[cfg(not(target_family = "wasm"))]
#[no_mangle]
pub extern "C" fn send_dart_signal_extern(
pub unsafe extern "C" fn send_dart_signal_extern(
message_id: i64,
message_pointer: *const u8,
message_size: usize,
Expand Down

0 comments on commit 98a8001

Please sign in to comment.