Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider making #[fastly::main] comply with clippy::pedantic #8

Open
matanlurey opened this issue Apr 19, 2024 · 0 comments
Open

Consider making #[fastly::main] comply with clippy::pedantic #8

matanlurey opened this issue Apr 19, 2024 · 0 comments

Comments

@matanlurey
Copy link

Most examples of getting started with Rust and Fastly introduce the following pattern:

#[fastly::main]
fn main(req: Request) -> Result<Response, Error> { /* ... */ }

For folks who enable clippy::pedantic, you'll get at least 3 lint warnings:

  • clippy::unnecessary_wraps

    Most code samples never return an Error, making Result<Response, Error> unnecessary.

    The macro could allow a return value of pure Response.

  • clippy::needless_pass_by_value

    The request object (req: Request) does not always need ownership.

    The macro could allow a parameter of &Request.

  • clippy::inline_always

    This is a false-positive, so probably the right thing to do is just tell users using pedantic to ignore it.

It's possible to work around these issues by following the instructions to bootstrap without the macro, or by using #[allow(clippy::lint_warning)] but figured I'd share the feedback anyway and see if any of these were intentional or easy to improve upon or if it's worth documenting using stricter lints with the Fastly Rust API.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant