chore: rust 1.54.0 clippy suggestions

This commit is contained in:
LongYinan 2021-07-30 12:54:59 +08:00
parent 5acfbc58f8
commit d864c71228
No known key found for this signature in database
GPG key ID: C3666B7FC82ADAD7
5 changed files with 12 additions and 12 deletions

View file

@ -44,16 +44,16 @@ pub fn register_js(exports: &mut JsObject, env: &Env) -> Result<()> {
"TestClass", "TestClass",
test_class_constructor, test_class_constructor,
&[ &[
Property::new(&env, "miterNative")? Property::new(env, "miterNative")?
.with_getter(get_miter_native) .with_getter(get_miter_native)
.with_setter(set_miter_native), .with_setter(set_miter_native),
Property::new(&env, "miter")? Property::new(env, "miter")?
.with_getter(get_miter) .with_getter(get_miter)
.with_setter(set_miter), .with_setter(set_miter),
Property::new(&env, "lineJoinNative")? Property::new(env, "lineJoinNative")?
.with_getter(get_line_join_native) .with_getter(get_line_join_native)
.with_setter(set_line_join_native), .with_setter(set_line_join_native),
Property::new(&env, "lineJoin")? Property::new(env, "lineJoin")?
.with_getter(get_line_join) .with_getter(get_line_join)
.with_setter(set_line_join), .with_setter(set_line_join),
], ],

View file

@ -44,7 +44,7 @@ pub fn setup() {
// If file does not exist, download it. // If file does not exist, download it.
if metadata(&node_lib_file_path).is_err() { if metadata(&node_lib_file_path).is_err() {
let node_lib = copy_node_lib(&arch); let node_lib = copy_node_lib(arch);
write(&node_lib_file_path, &node_lib).expect(&format!( write(&node_lib_file_path, &node_lib).expect(&format!(
"Could not save file to {}", "Could not save file to {}",

View file

@ -11,7 +11,7 @@ pub(crate) struct Ser<'env>(pub(crate) &'env Env);
impl<'env> Ser<'env> { impl<'env> Ser<'env> {
fn new(env: &'env Env) -> Self { fn new(env: &'env Env) -> Self {
Self(&env) Self(env)
} }
} }

View file

@ -8,8 +8,8 @@ struct NativeClass {
#[js_function(1)] #[js_function(1)]
fn create_test_class(ctx: CallContext) -> Result<JsFunction> { fn create_test_class(ctx: CallContext) -> Result<JsFunction> {
let add_count_method = Property::new(&ctx.env, "addCount")?.with_method(add_count); let add_count_method = Property::new(ctx.env, "addCount")?.with_method(add_count);
let add_native_count = Property::new(&ctx.env, "addNativeCount")?.with_method(add_native_count); let add_native_count = Property::new(ctx.env, "addNativeCount")?.with_method(add_native_count);
let properties = vec![add_count_method, add_native_count]; let properties = vec![add_count_method, add_native_count];
ctx ctx
.env .env
@ -47,8 +47,8 @@ fn add_native_count(ctx: CallContext) -> Result<JsNumber> {
#[js_function(1)] #[js_function(1)]
fn new_test_class(ctx: CallContext) -> Result<JsObject> { fn new_test_class(ctx: CallContext) -> Result<JsObject> {
let add_count_method = Property::new(&ctx.env, "addCount")?.with_method(add_count); let add_count_method = Property::new(ctx.env, "addCount")?.with_method(add_count);
let add_native_count = Property::new(&ctx.env, "addNativeCount")?.with_method(add_native_count); let add_native_count = Property::new(ctx.env, "addNativeCount")?.with_method(add_native_count);
let properties = vec![add_count_method, add_native_count]; let properties = vec![add_count_method, add_native_count];
let test_class = let test_class =
ctx ctx

View file

@ -135,8 +135,8 @@ fn test_delete_element(ctx: CallContext) -> Result<JsBoolean> {
#[js_function(1)] #[js_function(1)]
fn test_define_properties(ctx: CallContext) -> Result<JsUndefined> { fn test_define_properties(ctx: CallContext) -> Result<JsUndefined> {
let mut obj = ctx.get::<JsObject>(0)?; let mut obj = ctx.get::<JsObject>(0)?;
let add_method = Property::new(&ctx.env, "add")?.with_method(add); let add_method = Property::new(ctx.env, "add")?.with_method(add);
let readonly_property = Property::new(&ctx.env, "ro")?.with_getter(readonly_getter); let readonly_property = Property::new(ctx.env, "ro")?.with_getter(readonly_getter);
let properties = vec![add_method, readonly_property]; let properties = vec![add_method, readonly_property];
obj.define_properties(&properties)?; obj.define_properties(&properties)?;
obj.set_named_property("count", ctx.env.create_int32(0)?)?; obj.set_named_property("count", ctx.env.create_int32(0)?)?;