diff --git a/cfgrammar/src/lib/markmap.rs b/cfgrammar/src/lib/markmap.rs index 7c176276b..b0e6c2e45 100644 --- a/cfgrammar/src/lib/markmap.rs +++ b/cfgrammar/src/lib/markmap.rs @@ -375,7 +375,7 @@ impl MarkMap { } /// Returns an `Entry` for `key`. - pub fn entry(&mut self, key: K) -> Entry { + pub fn entry(&mut self, key: K) -> Entry<'_, K, V> { let pos = self.contents.binary_search_by(|(k, _, _)| k.cmp(&key)); match pos { Err(pos) => Entry::Vacant(VacantEntry { diff --git a/cfgrammar/src/lib/yacc/grammar.rs b/cfgrammar/src/lib/yacc/grammar.rs index 3e19c6d45..0c2634249 100644 --- a/cfgrammar/src/lib/yacc/grammar.rs +++ b/cfgrammar/src/lib/yacc/grammar.rs @@ -739,7 +739,7 @@ where /// based on the user-defined `token_cost` function which gives the associated cost for /// generating each token (where the cost must be greater than 0). Note that multiple /// tokens can have the same score. The simplest cost function is thus `|_| 1`. - pub fn sentence_generator(&self, token_cost: F) -> SentenceGenerator + pub fn sentence_generator(&self, token_cost: F) -> SentenceGenerator<'_, StorageT> where F: Fn(TIdx) -> u8, { diff --git a/cfgrammar/src/lib/yacc/parser.rs b/cfgrammar/src/lib/yacc/parser.rs index 3ac9e6392..4cd5ca402 100644 --- a/cfgrammar/src/lib/yacc/parser.rs +++ b/cfgrammar/src/lib/yacc/parser.rs @@ -314,7 +314,7 @@ fn add_duplicate_occurrence( /// The actual parser is intended to be entirely opaque from outside users. impl YaccParser<'_> { - pub(crate) fn new(yacc_kind: YaccKind, src: &str) -> YaccParser { + pub(crate) fn new(yacc_kind: YaccKind, src: &str) -> YaccParser<'_> { YaccParser { yacc_kind, src, diff --git a/lrlex/examples/calc_manual_lex/src/main.rs b/lrlex/examples/calc_manual_lex/src/main.rs index 6e210519a..14a6ba287 100644 --- a/lrlex/examples/calc_manual_lex/src/main.rs +++ b/lrlex/examples/calc_manual_lex/src/main.rs @@ -51,7 +51,7 @@ fn main() { } } -fn lex(s: &str) -> LRNonStreamingLexer> { +fn lex(s: &str) -> LRNonStreamingLexer<'_, '_, DefaultLexerTypes> { let mut lexemes = Vec::new(); let mut i = 0; while i < s.len() { diff --git a/lrlex/src/lib/lexer.rs b/lrlex/src/lib/lexer.rs index 14ad84644..0bff39abf 100644 --- a/lrlex/src/lib/lexer.rs +++ b/lrlex/src/lib/lexer.rs @@ -380,10 +380,10 @@ where ) -> (Option>, Option>); /// Returns an iterator over all rules in this AST. - fn iter_rules(&self) -> Iter>; + fn iter_rules(&self) -> Iter<'_, Rule>; /// Returns an iterator over all start states in this AST. - fn iter_start_states(&self) -> Iter; + fn iter_start_states(&self) -> Iter<'_, StartState>; } /// This struct represents, in essence, a .l file in memory. From it one can produce an @@ -517,11 +517,11 @@ where (missing_from_lexer, missing_from_parser) } - fn iter_rules(&self) -> Iter> { + fn iter_rules(&self) -> Iter<'_, Rule> { self.rules.iter() } - fn iter_start_states(&self) -> Iter { + fn iter_start_states(&self) -> Iter<'_, StartState> { self.start_states.iter() } } diff --git a/lrpar/src/lib/ctbuilder.rs b/lrpar/src/lib/ctbuilder.rs index d082ad943..be141fec9 100644 --- a/lrpar/src/lib/ctbuilder.rs +++ b/lrpar/src/lib/ctbuilder.rs @@ -53,6 +53,7 @@ static GENERATED_PATHS: LazyLock>> = struct CTConflictsError { conflicts_diagnostic: String, #[cfg(test)] + #[cfg_attr(test, allow(dead_code))] stable: StateTable, phantom: PhantomData, } diff --git a/lrtable/src/lib/statetable.rs b/lrtable/src/lib/statetable.rs index 317f7d3f0..a0689f369 100644 --- a/lrtable/src/lib/statetable.rs +++ b/lrtable/src/lib/statetable.rs @@ -433,7 +433,7 @@ where } /// Return an iterator over the indexes of all non-empty actions of `stidx`. - pub fn state_actions(&self, stidx: StIdx) -> StateActionsIterator { + pub fn state_actions(&self, stidx: StIdx) -> StateActionsIterator<'_, StorageT> { let start = usize::from(stidx) * usize::from(self.tokens_len); let end = start + usize::from(self.tokens_len); StateActionsIterator { @@ -445,7 +445,7 @@ where /// Return an iterator over the indexes of all shift actions of `stidx`. By definition this /// is a subset of the indexes produced by [`state_actions`](#method.state_actions). - pub fn state_shifts(&self, stidx: StIdx) -> StateActionsIterator { + pub fn state_shifts(&self, stidx: StIdx) -> StateActionsIterator<'_, StorageT> { let start = usize::from(stidx) * usize::from(self.tokens_len); let end = start + usize::from(self.tokens_len); StateActionsIterator { @@ -476,7 +476,7 @@ where /// And: [F -> c., $] /// /// since the two [E -> ...] items both have the same effects on a parse stack. - pub fn core_reduces(&self, stidx: StIdx) -> CoreReducesIterator { + pub fn core_reduces(&self, stidx: StIdx) -> CoreReducesIterator<'_, StorageT> { let start = usize::from(stidx) * usize::from(self.prods_len); let end = start + usize::from(self.prods_len); CoreReducesIterator {