Fix warnings and clippy errors