Skip to content

Fix tests and lints for new version of Rust #848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/cli/src/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
//! as well as ensuring that any features available in the plugin match the
//! features requsted by the JavaScript bytecode.

// Wizer doesn't provide a good API to set a custom WASI context so we put our
// WASI context in a static global variable and instruct the closure for
// getting the WASI context to use a mutable reference to it. There are never
// concurrent mutable references to the static WASI context so this is safe.
#![allow(static_mut_refs)]

mod builder;
use std::{fs, rc::Rc, sync::OnceLock};

Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ fn test_logging_with_redirect(builder: &mut Builder) -> Result<()> {
"hello world from console.log\nhello world from console.error\n",
logs.as_str(),
);
assert_fuel_consumed_within_threshold(36_042, fuel_consumed);
assert_fuel_consumed_within_threshold(35_007, fuel_consumed);
Ok(())
}

Expand Down
6 changes: 3 additions & 3 deletions crates/javy/src/serde/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl<'js> Deserializer<'js> {
}
}

impl<'de, 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
impl<'de> de::Deserializer<'de> for &mut Deserializer<'de> {
type Error = Error;

fn deserialize_any<V>(self, visitor: V) -> Result<V::Value>
Expand Down Expand Up @@ -307,7 +307,7 @@ impl<'a, 'de> MapAccess<'a, 'de> {
}
}

impl<'a, 'de> de::MapAccess<'de> for MapAccess<'a, 'de> {
impl<'de> de::MapAccess<'de> for MapAccess<'_, 'de> {
type Error = Error;

fn next_key_seed<K>(&mut self, seed: K) -> Result<Option<K::Value>>
Expand Down Expand Up @@ -422,7 +422,7 @@ impl<'a, 'de: 'a> SeqAccess<'a, 'de> {
}
}

impl<'a, 'de> de::SeqAccess<'de> for SeqAccess<'a, 'de> {
impl<'de> de::SeqAccess<'de> for SeqAccess<'_, 'de> {
type Error = Error;

fn next_element_seed<T>(&mut self, seed: T) -> Result<Option<T::Value>>
Expand Down
16 changes: 8 additions & 8 deletions crates/javy/src/serde/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl<'js> Serializer<'js> {
}
}

impl<'a> ser::Serializer for &'a mut Serializer<'_> {
impl ser::Serializer for &mut Serializer<'_> {
type Ok = ();
type Error = Error;

Expand Down Expand Up @@ -219,7 +219,7 @@ impl<'a> ser::Serializer for &'a mut Serializer<'_> {
}
}

impl<'a> ser::SerializeSeq for &'a mut Serializer<'_> {
impl ser::SerializeSeq for &mut Serializer<'_> {
type Ok = ();
type Error = Error;

Expand All @@ -243,7 +243,7 @@ impl<'a> ser::SerializeSeq for &'a mut Serializer<'_> {
}
}

impl<'a> ser::SerializeTuple for &'a mut Serializer<'_> {
impl ser::SerializeTuple for &mut Serializer<'_> {
type Ok = ();
type Error = Error;

Expand All @@ -268,7 +268,7 @@ impl<'a> ser::SerializeTuple for &'a mut Serializer<'_> {
}
}

impl<'a> ser::SerializeTupleStruct for &'a mut Serializer<'_> {
impl ser::SerializeTupleStruct for &mut Serializer<'_> {
type Ok = ();
type Error = Error;

Expand All @@ -292,7 +292,7 @@ impl<'a> ser::SerializeTupleStruct for &'a mut Serializer<'_> {
}
}

impl<'a> ser::SerializeTupleVariant for &'a mut Serializer<'_> {
impl ser::SerializeTupleVariant for &mut Serializer<'_> {
type Ok = ();
type Error = Error;

Expand All @@ -317,7 +317,7 @@ impl<'a> ser::SerializeTupleVariant for &'a mut Serializer<'_> {
}
}

impl<'a> ser::SerializeMap for &'a mut Serializer<'_> {
impl ser::SerializeMap for &mut Serializer<'_> {
type Ok = ();
type Error = Error;

Expand Down Expand Up @@ -354,7 +354,7 @@ impl<'a> ser::SerializeMap for &'a mut Serializer<'_> {
}
}

impl<'a> ser::SerializeStruct for &'a mut Serializer<'_> {
impl ser::SerializeStruct for &mut Serializer<'_> {
type Ok = ();
type Error = Error;

Expand All @@ -379,7 +379,7 @@ impl<'a> ser::SerializeStruct for &'a mut Serializer<'_> {
}
}

impl<'a> ser::SerializeStructVariant for &'a mut Serializer<'_> {
impl ser::SerializeStructVariant for &mut Serializer<'_> {
type Ok = ();
type Error = Error;

Expand Down
4 changes: 4 additions & 0 deletions crates/plugin-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
//! # Features
//! * `json` - enables the `json` feature in the `javy` crate.

// Allow these in this file because we only run this program single threaded
// and we can safely reason about the accesses to the Javy Runtime. We also
// don't want to introduce overhead from taking unnecessary mutex locks.
#![allow(static_mut_refs)]
use anyhow::{anyhow, bail, Error, Result};
pub use config::Config;
use javy::quickjs::{self, Ctx, Error as JSError, Function, Module, Value};
Expand Down
Loading