get rid of warnings

This commit is contained in:
Jaroslaw Konik 2025-05-10 16:37:56 +02:00
parent 253761c730
commit 191cfce733

View file

@ -1,21 +1,15 @@
use std::sync::mpsc::{Receiver, Sender};
use std::{ use std::{
cell::{LazyCell, OnceCell}, sync::LazyLock,
sync::{LazyLock, Mutex, OnceLock},
thread::{self, JoinHandle}, thread::{self, JoinHandle},
}; };
use bevy::{ use bevy::{
asset::Asset, asset::Asset,
ecs::{component::Component, entity::Entity, resource::Resource, schedule::ScheduleLabel}, ecs::{component::Component, resource::Resource, schedule::ScheduleLabel},
reflect::TypePath, reflect::TypePath,
}; };
use magnus::Ruby; use magnus::Ruby;
use magnus::{ use magnus::{embed::Cleanup, function, prelude::*};
embed::{init, Cleanup},
function,
prelude::*,
};
use serde::Deserialize; use serde::Deserialize;
use crate::{ use crate::{
@ -128,7 +122,7 @@ impl Runtime for RubyRuntime {
fn eval( fn eval(
&self, &self,
script: &Self::ScriptAsset, script: &Self::ScriptAsset,
entity: bevy::prelude::Entity, _entity: bevy::prelude::Entity,
) -> Result<Self::ScriptData, crate::ScriptingError> { ) -> Result<Self::ScriptData, crate::ScriptingError> {
let script = script.0.clone(); let script = script.0.clone();
RUBY_THREAD.execute_in(Box::new(move |ruby| { RUBY_THREAD.execute_in(Box::new(move |ruby| {
@ -141,8 +135,8 @@ impl Runtime for RubyRuntime {
fn register_fn( fn register_fn(
&mut self, &mut self,
name: String, name: String,
arg_types: Vec<std::any::TypeId>, _arg_types: Vec<std::any::TypeId>,
f: impl Fn( _f: impl Fn(
Self::CallContext, Self::CallContext,
Vec<Self::Value>, Vec<Self::Value>,
) -> Result< ) -> Result<
@ -152,7 +146,7 @@ impl Runtime for RubyRuntime {
+ Sync + Sync
+ 'static, + 'static,
) -> Result<(), crate::ScriptingError> { ) -> Result<(), crate::ScriptingError> {
fn callback(val: magnus::Value) -> magnus::Value { fn callback(_val: magnus::Value) -> magnus::Value {
let ruby = magnus::Ruby::get().unwrap(); let ruby = magnus::Ruby::get().unwrap();
ruby.qnil().as_value() ruby.qnil().as_value()
} }
@ -168,9 +162,9 @@ impl Runtime for RubyRuntime {
fn call_fn( fn call_fn(
&self, &self,
name: &str, name: &str,
script_data: &mut Self::ScriptData, _script_data: &mut Self::ScriptData,
entity: bevy::prelude::Entity, _entity: bevy::prelude::Entity,
args: impl for<'a> crate::FuncArgs<'a, Self::Value, Self>, _args: impl for<'a> crate::FuncArgs<'a, Self::Value, Self>,
) -> Result<Self::Value, crate::ScriptingError> { ) -> Result<Self::Value, crate::ScriptingError> {
let name = name.to_string(); let name = name.to_string();
RUBY_THREAD.execute_in(Box::new(move |ruby| { RUBY_THREAD.execute_in(Box::new(move |ruby| {
@ -183,9 +177,9 @@ impl Runtime for RubyRuntime {
fn call_fn_from_value( fn call_fn_from_value(
&self, &self,
value: &Self::Value, _value: &Self::Value,
context: &Self::CallContext, _context: &Self::CallContext,
args: Vec<Self::Value>, _args: Vec<Self::Value>,
) -> Result<Self::Value, crate::ScriptingError> { ) -> Result<Self::Value, crate::ScriptingError> {
todo!() todo!()
} }
@ -196,13 +190,13 @@ pub mod prelude {
} }
impl<T> FromRuntimeValueWithEngine<'_, RubyRuntime> for T { impl<T> FromRuntimeValueWithEngine<'_, RubyRuntime> for T {
fn from_runtime_value_with_engine(value: RubyValue, engine: &magnus::Ruby) -> Self { fn from_runtime_value_with_engine(_value: RubyValue, _engine: &magnus::Ruby) -> Self {
todo!(); todo!();
} }
} }
impl<T> IntoRuntimeValueWithEngine<'_, T, RubyRuntime> for T { impl<T> IntoRuntimeValueWithEngine<'_, T, RubyRuntime> for T {
fn into_runtime_value_with_engine(value: T, engine: &magnus::Ruby) -> RubyValue { fn into_runtime_value_with_engine(_value: T, _engine: &magnus::Ruby) -> RubyValue {
RubyValue(()) RubyValue(())
} }
} }
@ -214,8 +208,8 @@ impl FuncArgs<'_, RubyValue, RubyRuntime> for () {
} }
impl<T> FuncArgs<'_, RubyValue, RubyRuntime> for Vec<T> { impl<T> FuncArgs<'_, RubyValue, RubyRuntime> for Vec<T> {
fn parse(self, engine: &magnus::Ruby) -> Vec<RubyValue> { fn parse(self, _engine: &magnus::Ruby) -> Vec<RubyValue> {
self.into_iter().map(|x| RubyValue(())).collect() self.into_iter().map(|_x| RubyValue(())).collect()
} }
} }
@ -224,7 +218,7 @@ macro_rules! impl_tuple {
impl<'a, $($t,)+> FuncArgs<'a, RubyValue, RubyRuntime> impl<'a, $($t,)+> FuncArgs<'a, RubyValue, RubyRuntime>
for ($($t,)+) for ($($t,)+)
{ {
fn parse(self, engine: &'a magnus::Ruby) -> Vec<RubyValue> { fn parse(self, _engine: &'a magnus::Ruby) -> Vec<RubyValue> {
todo!(); todo!();
} }
} }