These two default implementations are passing a &&Self instead of &Self to the target function in place of &A where A: Automaton. This is unnecessary as Self is implementing Automaton so we can pass self directly.
Although this is not a problem by itself, it can possibly cause an infinite loop when converting an Automaton to a dynamic object (as theoretically in each call a new type is evaluated for the implementation of Automaton). (Unfortunately I cannot regenerate how I managed to cause the compile error, but it's possible!).
BTW, I'm wondering why such implementation (impl<'a, A: Automaton + ?Sized> Automaton for &'a A) should exist. I'll open a PR to remove it if you don't mind.
These two default implementations are passing a
&&Self
instead of&Self
to the target function in place of&A
whereA: Automaton
. This is unnecessary asSelf
is implementingAutomaton
so we can passself
directly.https://github.com/BurntSushi/aho-corasick/blob/948d2e1f8e4b6b0aff13075176922e158c8bed46/src/automaton.rs#L358 and https://github.com/BurntSushi/aho-corasick/blob/948d2e1f8e4b6b0aff13075176922e158c8bed46/src/automaton.rs#L372
Although this is not a problem by itself, it can possibly cause an infinite loop when converting an
Automaton
to a dynamic object (as theoretically in each call a new type is evaluated for the implementation ofAutomaton
). (Unfortunately I cannot regenerate how I managed to cause the compile error, but it's possible!).