You don't do so here, but there's nothing that says the body of the function can't make use of it's generic parameters even when they aren't used in the inputs or outputs. For example.
For all the compiler knows, you have some future use planned for the currently unused parameter.
That said, I could see a warn-by-default lint in this case, as there's not a whole lot you can do with unconstrained lifetime not used in the inputs or outputs.
❯ cargo clippy
Checking hello_world v0.1.0 (/Volumes/T7/trash/2023_04_28/hello_world)
warning: this lifetime isn't used in the function definition
--> src/main.rs:1:16
|
1 | fn longest<'a, 'b>(s1: &'a str, s2: &'a str) -> &'a str {
| ^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
= note: `#[warn(clippy::extra_unused_lifetimes)]` on by default