Skip to content
Closed
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
7 changes: 6 additions & 1 deletion src-rs/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ use crate::{

type MakeFuncImpl = fn(&[Arc<Value>], &mut Evaluator, &mut dyn BufMut) -> Result<()>;

#[derive(PartialEq)]
pub struct FuncInfo {
pub name: &'static [u8],
pub func: MakeFuncImpl,
Expand All @@ -63,6 +62,12 @@ pub struct FuncInfo {
pub trim_right_space_1st: bool,
}

impl PartialEq for FuncInfo {
fn eq(&self, other: &Self) -> bool {
self.name == other.name
}
}

impl Debug for FuncInfo {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Func({})", String::from_utf8_lossy(self.name))
Expand Down
2 changes: 1 addition & 1 deletion src-rs/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ pub struct ParsedAssign<'a> {
pub rhs: &'a [u8],
pub op: AssignOp,
}
pub fn parse_assign_statement(line: &[u8], sep: usize) -> ParsedAssign {
pub fn parse_assign_statement(line: &'_ [u8], sep: usize) -> ParsedAssign<'_> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the lifetime on the argument, it's not necessary. Same in var.rs.

assert!(sep != 0);
let mut op = AssignOp::Eq;
let mut lhs = &line[..sep];
Expand Down
2 changes: 1 addition & 1 deletion src-rs/var.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl Variable {
}
Ok(())
}
pub fn string(&self) -> Result<Cow<[u8]>> {
pub fn string(&'_ self) -> Result<Cow<'_, [u8]>> {
Ok(match &self.value {
InnerVar::Simple(s) => Cow::Borrowed(s.as_slice()),
InnerVar::Recursive { v: _, orig } => Cow::Borrowed(orig),
Expand Down
Loading