fix warnings in botscript.rs
This commit is contained in:
parent
0c3fb0788a
commit
e6c9cfb0c1
@ -760,7 +760,11 @@ impl NotificationFilter {
|
|||||||
NotificationFilter::Random { random } => Ok(db.get_random_users(*random).await?),
|
NotificationFilter::Random { random } => Ok(db.get_random_users(*random).await?),
|
||||||
NotificationFilter::BotFunction(f) => {
|
NotificationFilter::BotFunction(f) => {
|
||||||
let users = f.call()?;
|
let users = f.call()?;
|
||||||
let users = from_js(f.context().unwrap(), &users)?;
|
// we just called function, so context is definetly valid
|
||||||
|
let users = from_js(
|
||||||
|
f.context().expect("Context invalid after function call"),
|
||||||
|
&users,
|
||||||
|
)?;
|
||||||
Ok(users)
|
Ok(users)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -768,7 +772,7 @@ impl NotificationFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Parcelable<BotFunction> for NotificationFilter {
|
impl Parcelable<BotFunction> for NotificationFilter {
|
||||||
fn get_field(&mut self, name: &str) -> ParcelableResult<ParcelType<BotFunction>> {
|
fn get_field(&mut self, _name: &str) -> ParcelableResult<ParcelType<BotFunction>> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -798,7 +802,7 @@ pub enum NotificationMessage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Parcelable<BotFunction> for NotificationMessage {
|
impl Parcelable<BotFunction> for NotificationMessage {
|
||||||
fn get_field(&mut self, name: &str) -> ParcelableResult<ParcelType<BotFunction>> {
|
fn get_field(&mut self, _name: &str) -> ParcelableResult<ParcelType<BotFunction>> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1060,7 +1064,6 @@ impl Runner {
|
|||||||
#[allow(clippy::unwrap_used)]
|
#[allow(clippy::unwrap_used)]
|
||||||
#[allow(clippy::print_stdout)]
|
#[allow(clippy::print_stdout)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use quickjs_rusty::OwnedJsObject;
|
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
@ -1106,22 +1109,6 @@ mod tests {
|
|||||||
assert_eq!(sres, "cancelation");
|
assert_eq!(sres, "cancelation");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn recursive_format(o: OwnedJsObject) -> String {
|
|
||||||
let props: Vec<_> = o.properties_iter().unwrap().map(|x| x.unwrap()).collect();
|
|
||||||
let sp: Vec<String> = props
|
|
||||||
.into_iter()
|
|
||||||
.map(|v| {
|
|
||||||
if v.is_object() {
|
|
||||||
recursive_format(v.try_into_object().unwrap())
|
|
||||||
} else {
|
|
||||||
format!("{:?}", v)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
format!("{:?}", sp)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_run_script_invalid() {
|
fn test_run_script_invalid() {
|
||||||
let runner = Runner::init().unwrap();
|
let runner = Runner::init().unwrap();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user