diff --git a/Cargo.lock b/Cargo.lock index fad9b95..3a2457b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -225,7 +225,7 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hexo" -version = "0.9.2" +version = "0.9.3" dependencies = [ "clap", "console", diff --git a/Cargo.toml b/Cargo.toml index bf185dc..2104b2d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hexo" -version = "0.9.2" +version = "0.9.3" edition = "2021" license = "Apache-2.0" repository = "https://github.com/lexa-diky/hexo" diff --git a/src/compiler/native_fn/implementations.rs b/src/compiler/native_fn/implementations.rs index 1e0eceb..ac9ed5c 100644 --- a/src/compiler/native_fn/implementations.rs +++ b/src/compiler/native_fn/implementations.rs @@ -11,8 +11,8 @@ pub(crate) fn create_len_native_function() -> NativeFunction { NativeFunctionSignature::new("len"), |arguments, _| { let mut result = ByteBuffer::default(); - let arg0 = get_named_argument(&arguments, "utf8") - .unwrap_or_else(|| get_argument_at(&arguments, 0, "len").unwrap()); + let arg0 = get_named_argument(arguments, "utf8") + .unwrap_or_else(|| get_argument_at(arguments, 0, "len").unwrap()); let len = arg0.len() as u32; result.push_u32_shrunk(len); @@ -25,8 +25,8 @@ pub(crate) fn create_pad_left_native_function() -> NativeFunction { NativeFunction::new( NativeFunctionSignature::new("pad_left"), |arguments, _| { - let mut arg0 = get_argument_at(&arguments, 0, "pad_left")?.clone(); - let arg1 = get_argument_at(&arguments, 1, "pad_left")?; + let mut arg0 = get_argument_at(arguments, 0, "pad_left")?.clone(); + let arg1 = get_argument_at(arguments, 1, "pad_left")?; arg0.pad_left(arg1.as_usize_unsafe()); @@ -39,8 +39,8 @@ pub(crate) fn create_pad_right_native_function() -> NativeFunction { NativeFunction::new( NativeFunctionSignature::new("pad_right"), |arguments, _| { - let mut arg0: ByteBuffer = get_argument_at(&arguments, 0, "pad_right")?.clone(); - let arg1 = get_argument_at(&arguments, 1, "pad_right")?; + let mut arg0: ByteBuffer = get_argument_at(arguments, 0, "pad_right")?.clone(); + let arg1 = get_argument_at(arguments, 1, "pad_right")?; arg0.pad_right(arg1.as_usize_unsafe()); @@ -53,7 +53,7 @@ pub(crate) fn create_cmd_native_function() -> NativeFunction { NativeFunction::new( NativeFunctionSignature::new_unsafe("cmd"), |arguments, _| { - let command = get_argument_at(&arguments, 0, "cmd")? + let command = get_argument_at(arguments, 0, "cmd")? .to_string() .map_err(|e| Error::Unknown(e.to_string()))?; @@ -72,7 +72,7 @@ pub(crate) fn create_read_file_native_function() -> NativeFunction { NativeFunction::new( NativeFunctionSignature::new("read_file"), |arguments, _| { - let arg0 = get_argument_at(&arguments, 0, "read_file")?; + let arg0 = get_argument_at(arguments, 0, "read_file")?; let file_path = arg0 .to_string() @@ -96,11 +96,11 @@ pub(crate) fn create_pad_native_function() -> NativeFunction { NativeFunction::new( NativeFunctionSignature::new("pad"), |arguments, _| { - let mut buffer = get_argument_at(&arguments, 0, "pad")?.clone(); + let mut buffer = get_argument_at(arguments, 0, "pad")?.clone(); - let left_padding = get_named_argument(&arguments, "left").map(|b| b.as_usize_unsafe()); + let left_padding = get_named_argument(arguments, "left").map(|b| b.as_usize_unsafe()); let right_padding = - get_named_argument(&arguments, "right").map(|b| b.as_usize_unsafe()); + get_named_argument(arguments, "right").map(|b| b.as_usize_unsafe()); if let Some(size) = left_padding { buffer.pad_left(size); @@ -118,7 +118,7 @@ pub(crate) fn create_eval_native_function() -> NativeFunction { NativeFunction::new( NativeFunctionSignature::new_unsafe("eval"), |arguments, compiler| { - let buffer = get_argument_at(&arguments, 0, "eval")?.clone(); + let buffer = get_argument_at(arguments, 0, "eval")?.clone(); let source = LiteralCompilerSource::anonymous( buffer.to_string() .map_err(|e| Error::Unknown(e.to_string()))?, diff --git a/src/compiler/rst/compiler.rs b/src/compiler/rst/compiler.rs index def6ea3..447b808 100644 --- a/src/compiler/rst/compiler.rs +++ b/src/compiler/rst/compiler.rs @@ -102,7 +102,7 @@ impl RstCompiler<'_> { params_buffer.insert(param.name().to_string(), param_buffer); } - executor(&¶ms_buffer, self.parent) + executor(¶ms_buffer, self.parent) .map(|bb| buffer.push_byte_buffer(&bb)) .map_err(Error::NativeFunctionExecution)?; diff --git a/src/compiler/rst/node.rs b/src/compiler/rst/node.rs index f373c20..ce12363 100644 --- a/src/compiler/rst/node.rs +++ b/src/compiler/rst/node.rs @@ -20,7 +20,7 @@ impl HexoFile { } pub(crate) fn path(&self) -> &Path { - &self.path.as_path() + &self.path } pub(crate) fn context(&self) -> &CompilationContext {