@@ -18,7 +18,7 @@ pub fn parse(input: &str) -> Vec<&str> {
18
18
}
19
19
20
20
pub fn part1 ( input : & [ & str ] ) -> u64 {
21
- fn helper ( bytes : & mut Bytes ) -> u64 {
21
+ fn helper ( bytes : & mut Bytes < ' _ > ) -> u64 {
22
22
let mut total = value ( bytes, helper) ;
23
23
24
24
while let Some ( operation) = next ( bytes) {
@@ -37,7 +37,7 @@ pub fn part1(input: &[&str]) -> u64 {
37
37
}
38
38
39
39
pub fn part2 ( input : & [ & str ] ) -> u64 {
40
- fn helper ( bytes : & mut Bytes ) -> u64 {
40
+ fn helper ( bytes : & mut Bytes < ' _ > ) -> u64 {
41
41
let mut total = value ( bytes, helper) ;
42
42
43
43
while let Some ( operation) = next ( bytes) {
@@ -60,7 +60,7 @@ pub fn part2(input: &[&str]) -> u64 {
60
60
/// Convenience wrapper around [`Bytes`] iterator. Encountering a `)` is also considered end of
61
61
/// sequence. The expressions are consistently formatted so encountering a space just means
62
62
/// skip and return the next character that will always be present.
63
- fn next ( bytes : & mut Bytes ) -> Option < u8 > {
63
+ fn next ( bytes : & mut Bytes < ' _ > ) -> Option < u8 > {
64
64
match bytes. next ( ) {
65
65
None | Some ( b')' ) => None ,
66
66
Some ( b' ' ) => bytes. next ( ) ,
@@ -70,7 +70,7 @@ fn next(bytes: &mut Bytes) -> Option<u8> {
70
70
71
71
/// Convenience wrapper to return the value of either the next raw digit literal or a
72
72
/// sub-expression nested in parentheses.
73
- fn value ( bytes : & mut Bytes , helper : impl Fn ( & mut Bytes ) -> u64 ) -> u64 {
73
+ fn value ( bytes : & mut Bytes < ' _ > , helper : impl Fn ( & mut Bytes < ' _ > ) -> u64 ) -> u64 {
74
74
match next ( bytes) . unwrap ( ) {
75
75
b'(' => helper ( bytes) ,
76
76
b => b. to_decimal ( ) as u64 ,
0 commit comments