Skip to content

Update Rust edition to 2024 #2

@YamatoSecurity

Description

@YamatoSecurity

Is it possible to fix these errors to update this to edition 2024?

I get these errors:

error: binding modifiers may only be written when the default binding mode is `move`
  --> src/detection/lexer.rs:22:29
   |
22 |             Self::Selection(ref s) => write!(f, "{}", s),
   |                             ^^^ binding modifier not allowed under `ref` default binding mode
   |
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
note: matching on a reference type with a non-reference pattern changes the default binding mode
  --> src/detection/lexer.rs:22:13
   |
22 |             Self::Selection(ref s) => write!(f, "{}", s),
   |             ^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_`
help: remove the unnecessary binding modifier
   |
22 -             Self::Selection(ref s) => write!(f, "{}", s),
22 +             Self::Selection(s) => write!(f, "{}", s),
   |

error: binding modifiers may only be written when the default binding mode is `move`
  --> src/detection/lexer.rs:28:25
   |
28 |             Self::OneOf(ref s) => write!(f, "1 of {}", s),
   |                         ^^^ binding modifier not allowed under `ref` default binding mode
   |
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
note: matching on a reference type with a non-reference pattern changes the default binding mode
  --> src/detection/lexer.rs:28:13
   |
28 |             Self::OneOf(ref s) => write!(f, "1 of {}", s),
   |             ^^^^^^^^^^^^^^^^^^ this matches on type `&_`
help: remove the unnecessary binding modifier
   |
28 -             Self::OneOf(ref s) => write!(f, "1 of {}", s),
28 +             Self::OneOf(s) => write!(f, "1 of {}", s),
   |

error: binding modifiers may only be written when the default binding mode is `move`
  --> src/detection/lexer.rs:29:25
   |
29 |             Self::AllOf(ref s) => write!(f, "all of {}", s),
   |                         ^^^ binding modifier not allowed under `ref` default binding mode
   |
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
note: matching on a reference type with a non-reference pattern changes the default binding mode
  --> src/detection/lexer.rs:29:13
   |
29 |             Self::AllOf(ref s) => write!(f, "all of {}", s),
   |             ^^^^^^^^^^^^^^^^^^ this matches on type `&_`
help: remove the unnecessary binding modifier
   |
29 -             Self::AllOf(ref s) => write!(f, "all of {}", s),
29 +             Self::AllOf(s) => write!(f, "all of {}", s),
   |

error: binding modifiers may only be written when the default binding mode is `move`
   --> src/detection.rs:139:22
    |
139 |             Ast::Not(ref operand) => !self.eval(event, operand, lookup),
    |                      ^^^ binding modifier not allowed under `ref` default binding mode
    |
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
note: matching on a reference type with a non-reference pattern changes the default binding mode
   --> src/detection.rs:139:13
    |
139 |             Ast::Not(ref operand) => !self.eval(event, operand, lookup),
    |             ^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_`
help: remove the unnecessary binding modifier
    |
139 -             Ast::Not(ref operand) => !self.eval(event, operand, lookup),
139 +             Ast::Not(operand) => !self.eval(event, operand, lookup),
    |

error: binding modifiers may only be written when the default binding mode is `move`
   --> src/detection.rs:140:21
    |
140 |             Ast::Or(ref left, ref right) => {
    |                     ^^^       ^^^ binding modifier not allowed under `ref` default binding mode
    |                     |
    |                     binding modifier not allowed under `ref` default binding mode
    |
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
note: matching on a reference type with a non-reference pattern changes the default binding mode
   --> src/detection.rs:140:13
    |
140 |             Ast::Or(ref left, ref right) => {
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_`
help: remove the unnecessary binding modifiers
    |
140 -             Ast::Or(ref left, ref right) => {
140 +             Ast::Or(left, right) => {
    |

error: binding modifiers may only be written when the default binding mode is `move`
   --> src/detection.rs:143:22
    |
143 |             Ast::And(ref left, ref right) => {
    |                      ^^^       ^^^ binding modifier not allowed under `ref` default binding mode
    |                      |
    |                      binding modifier not allowed under `ref` default binding mode
    |
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
note: matching on a reference type with a non-reference pattern changes the default binding mode
   --> src/detection.rs:143:13
    |
143 |             Ast::And(ref left, ref right) => {
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this matches on type `&_`
help: remove the unnecessary binding modifiers
    |
143 -             Ast::And(ref left, ref right) => {
143 +             Ast::And(left, right) => {
    |

error: could not compile `sigma-rust` (lib) due to 6 previous errors

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions