style: apply clippy suggestion
This commit is contained in:
parent
9f66ca2818
commit
89893cdca3
5 changed files with 6 additions and 6 deletions
|
@ -76,7 +76,7 @@ fn escape_json(src: &str) -> String {
|
|||
c => {
|
||||
let encoded = c.encode_utf16(&mut utf16_buf);
|
||||
for utf16 in encoded {
|
||||
write!(&mut escaped, "\\u{:04X}", utf16).unwrap();
|
||||
write!(escaped, "\\u{:04X}", utf16).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ use napi::{CallContext, JsArrayBuffer, JsNumber, JsObject, JsTypedArray, JsUndef
|
|||
#[js_function(1)]
|
||||
pub fn get_arraybuffer_length(ctx: CallContext) -> Result<JsNumber> {
|
||||
let buffer = ctx.get::<JsArrayBuffer>(0)?.into_value()?;
|
||||
ctx.env.create_uint32((&buffer).len() as u32)
|
||||
ctx.env.create_uint32(buffer.len() as u32)
|
||||
}
|
||||
|
||||
#[js_function(1)]
|
||||
|
|
|
@ -9,7 +9,7 @@ use napi::{
|
|||
#[js_function(1)]
|
||||
pub fn get_buffer_length(ctx: CallContext) -> Result<JsNumber> {
|
||||
let buffer = ctx.get::<JsBuffer>(0)?.into_value()?;
|
||||
ctx.env.create_uint32((&buffer).len() as u32)
|
||||
ctx.env.create_uint32(buffer.len() as u32)
|
||||
}
|
||||
|
||||
#[js_function(1)]
|
||||
|
|
|
@ -60,7 +60,7 @@ impl Task for CountBufferLength {
|
|||
if self.data.len() == 10 {
|
||||
return Err(Error::from_reason("len can't be 5".to_string()));
|
||||
}
|
||||
Ok((&self.data).len())
|
||||
Ok(self.data.len())
|
||||
}
|
||||
|
||||
fn resolve(&mut self, env: Env, output: Self::Output) -> Result<Self::JsValue> {
|
||||
|
|
|
@ -234,7 +234,7 @@ impl JsAsset {
|
|||
|
||||
#[napi(getter)]
|
||||
pub fn get_file_path(&self) -> u32 {
|
||||
return 1;
|
||||
1
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,7 +277,7 @@ impl Optional {
|
|||
pub fn option_only(optional: Option<String>) -> String {
|
||||
match optional {
|
||||
None => "".to_string(),
|
||||
Some(optional) => format!("{}", optional),
|
||||
Some(optional) => optional,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue