Skip to content

refactor: refactor first and follow (#1) #20

refactor: refactor first and follow (#1)

refactor: refactor first and follow (#1) #20

Triggered via push November 18, 2023 16:02
Status Success
Total duration 30s
Artifacts

scheduled.yml

on: push
check-links
6s
check-links
ubuntu / nightly
19s
ubuntu / nightly
ubuntu / beta / updated
4s
ubuntu / beta / updated
Fit to window
Zoom out
Zoom in

Annotations

19 warnings
called `map(..).flatten()` on `Iterator`: src/lr0/lookup.rs#L31
warning: called `map(..).flatten()` on `Iterator` --> src/lr0/lookup.rs:31:14 | 31 | .map(|production| production.rhs_iter().map(|expr| (&production.lhs, expr))) | ______________^ 32 | | .flatten() | |______________________^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|production| production.rhs_iter().map(|expr| (&production.lhs, expr)))` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
called `map(..).flatten()` on `Iterator`: src/lr0/lookup.rs#L21
warning: called `map(..).flatten()` on `Iterator` --> src/lr0/lookup.rs:21:14 | 21 | .map(|production| production.rhs_iter().map(|expr| (&production.lhs, expr))) | ______________^ 22 | | .flatten() | |______________________^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|production| production.rhs_iter().map(|expr| (&production.lhs, expr)))` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten = note: `#[warn(clippy::map_flatten)]` on by default
use of `filter_map` with an identity function: src/lr0/core.rs#L129
warning: use of `filter_map` with an identity function --> src/lr0/core.rs:129:14 | 129 | .filter_map(|item| item) | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `flatten()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#filter_map_identity = note: `#[warn(clippy::filter_map_identity)]` on by default
this expression creates a reference which is immediately dereferenced by the compiler: src/lr0/core.rs#L82
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/lr0/core.rs:82:34 | 82 | let lookup = Lookup::new(&grammar); | ^^^^^^^^ help: change this to: `grammar` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
you should consider adding a `Default` implementation for `LR0ItemSet<'grammar>`: src/lr0/core.rs#L76
warning: you should consider adding a `Default` implementation for `LR0ItemSet<'grammar>` --> src/lr0/core.rs:76:5 | 76 | / pub fn new() -> Self { 77 | | Self { 78 | | items: HashSet::new(), 79 | | } 80 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default = note: `#[warn(clippy::new_without_default)]` on by default help: try adding this | 75 + impl<'grammar> Default for LR0ItemSet<'grammar> { 76 + fn default() -> Self { 77 + Self::new() 78 + } 79 + } |
`to_string` applied to a type that implements `Display` in `println!` args: src/lr0/builder.rs#L57
warning: `to_string` applied to a type that implements `Display` in `println!` args --> src/lr0/builder.rs:57:25 | 57 | term.to_string(), | ^^^^^^^^^^^^ help: remove this | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#to_string_in_format_args = note: `#[warn(clippy::to_string_in_format_args)]` on by default
this expression creates a reference which is immediately dereferenced by the compiler: src/lr0/builder.rs#L51
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/lr0/builder.rs:51:47 | 51 | let cur_index = self.index_of(&closure); | ^^^^^^^^ help: change this to: `closure` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/lr0/builder.rs#L45
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/lr0/builder.rs:45:33 | 45 | for term in symbols(&self.grammar) { | ^^^^^^^^^^^^^ help: change this to: `self.grammar` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/lr0/builder.rs#L33
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/lr0/builder.rs:33:21 | 33 | symbols(&self.grammar).iter().for_each(|term| { | ^^^^^^^^^^^^^ help: change this to: `self.grammar` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
this expression creates a reference which is immediately dereferenced by the compiler: src/lr0/builder.rs#L22
warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/lr0/builder.rs:22:75 | 22 | let initial = LR0ItemSet::from_iter(vec![LR0Item::from_production(&augmentation).unwrap()]); | ^^^^^^^^^^^^^ help: change this to: `augmentation` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `#[warn(clippy::needless_borrow)]` on by default
multiple associated items are never used: src/utils/follow/builder.rs#L16
warning: multiple associated items are never used --> src/utils/follow/builder.rs:16:19 | 15 | impl<'grammar> FollowBuilder<'grammar> { | -------------------------------------- associated items in this implementation 16 | pub(crate) fn new(grammar: &'grammar Grammar) -> FollowBuilder<'grammar> { | ^^^ ... 37 | pub fn build_follow(&mut self, start: &'grammar Term) { | ^^^^^^^^^^^^ ... 101 | pub fn first_produce_epsilon(&self, term: &Term) -> bool { | ^^^^^^^^^^^^^^^^^^^^^ ... 111 | pub(crate) fn insert_term(&self, x: &'grammar Term, term: &'grammar Term) -> bool { | ^^^^^^^^^^^ ... 126 | pub(crate) fn insert_epsilon(&self, x: &'grammar Term) -> bool { | ^^^^^^^^^^^^^^ ... 131 | pub(crate) fn insert_dollar(&self, x: &'grammar Term) -> bool { | ^^^^^^^^^^^^^ ... 136 | pub(crate) fn insert_set(&self, x: &'grammar Term, set: HashSet<&'grammar Term>) -> bool { | ^^^^^^^^^^ ... 150 | pub(crate) fn follow(&self, x: &Term) -> HashSet<&'grammar Term> { | ^^^^^^ ... 158 | pub(crate) fn insert_follow(&mut self, rx: &'grammar Term, tx: &'grammar Term) -> bool { | ^^^^^^^^^^^^^ ... 166 | pub(crate) fn build(mut self, start: &'grammar Term) -> Follow<'grammar> { | ^^^^^
struct `FollowBuilder` is never constructed: src/utils/follow/builder.rs#L9
warning: struct `FollowBuilder` is never constructed --> src/utils/follow/builder.rs:9:12 | 9 | pub struct FollowBuilder<'grammar> { | ^^^^^^^^^^^^^
struct `Follow` is never constructed: src/utils/follow/mod.rs#L6
warning: struct `Follow` is never constructed --> src/utils/follow/mod.rs:6:12 | 6 | pub struct Follow<'grammar> { | ^^^^^^
multiple associated items are never used: src/utils/first/builder.rs#L14
warning: multiple associated items are never used --> src/utils/first/builder.rs:14:19 | 13 | impl<'grammar> FirstBuilder<'grammar> { | ------------------------------------- associated items in this implementation 14 | pub(crate) fn new(grammar: &'grammar Grammar) -> FirstBuilder<'grammar> { | ^^^ ... 39 | pub(crate) fn build_first(&mut self) { | ^^^^^^^^^^^ ... 104 | fn produce_epsilon(&self, term: &Term) -> bool { | ^^^^^^^^^^^^^^^ ... 140 | pub(crate) fn insert_term(&self, x: &'grammar Term, term: &'grammar Term) -> bool { | ^^^^^^^^^^^ ... 156 | pub(crate) fn insert_epsilon(&self, x: &'grammar Term) -> bool { | ^^^^^^^^^^^^^^ ... 161 | pub(crate) fn first(&self, x: &Term) -> HashSet<&'grammar Term> { | ^^^^^ ... 168 | pub(crate) fn insert_set(&self, x: &'grammar Term, set: HashSet<&'grammar Term>) -> bool { | ^^^^^^^^^^ ... 186 | pub(crate) fn insert_first_no_epsilon(&self, x: &'grammar Term, y: &'grammar Term) -> bool { | ^^^^^^^^^^^^^^^^^^^^^^^ ... 195 | pub(crate) fn build(mut self) -> First<'grammar> { | ^^^^^
struct `FirstBuilder` is never constructed: src/utils/first/builder.rs#L7
warning: struct `FirstBuilder` is never constructed --> src/utils/first/builder.rs:7:12 | 7 | pub struct FirstBuilder<'grammar> { | ^^^^^^^^^^^^
associated function `new` is never used: src/utils/first/mod.rs#L12
warning: associated function `new` is never used --> src/utils/first/mod.rs:12:12 | 11 | impl<'grammar> First<'grammar> { | ------------------------------ associated function in this implementation 12 | pub fn new(grammar: &'grammar Grammar) -> First<'grammar> { | ^^^
struct `First` is never constructed: src/utils/first/mod.rs#L7
warning: struct `First` is never constructed --> src/utils/first/mod.rs:7:12 | 7 | pub struct First<'grammar> { | ^^^^^
function `dollar` is never used: src/utils/mod.rs#L21
warning: function `dollar` is never used --> src/utils/mod.rs:21:4 | 21 | fn dollar() -> &'static Term { | ^^^^^^
function `epsilon` is never used: src/utils/mod.rs#L16
warning: function `epsilon` is never used --> src/utils/mod.rs:16:8 | 16 | pub fn epsilon() -> &'static Term { | ^^^^^^^ | = note: `#[warn(dead_code)]` on by default