Skip to content

Commit

Permalink
clippy run + version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
lexa-diky committed Jul 10, 2024
1 parent 045d7c3 commit 24eeaec
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
24 changes: 12 additions & 12 deletions src/compiler/native_fn/implementations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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());

Expand All @@ -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());

Expand All @@ -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()))?;

Expand All @@ -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()
Expand All @@ -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);
Expand All @@ -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()))?,
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/rst/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl RstCompiler<'_> {
params_buffer.insert(param.name().to_string(), param_buffer);
}

executor(&&params_buffer, self.parent)
executor(&params_buffer, self.parent)
.map(|bb| buffer.push_byte_buffer(&bb))
.map_err(Error::NativeFunctionExecution)?;

Expand Down
2 changes: 1 addition & 1 deletion src/compiler/rst/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl HexoFile {
}

pub(crate) fn path(&self) -> &Path {
&self.path.as_path()
&self.path
}

pub(crate) fn context(&self) -> &CompilationContext {
Expand Down

0 comments on commit 24eeaec

Please sign in to comment.