Skip to content

Lint for functions that don't return but aren't written as "-> !" #12836

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

Closed
jruderman opened this issue Mar 12, 2014 · 7 comments
Closed

Lint for functions that don't return but aren't written as "-> !" #12836

jruderman opened this issue Mar 12, 2014 · 7 comments
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-type-system Area: Type system

Comments

@jruderman
Copy link
Contributor

I think this should warn: f never returns, but it claims to return int.

fn f() -> int {
  fail!("f")
}

fn main() {
  f();
}
@huonw huonw added A-linkage and removed A-linkage labels Mar 12, 2014
@sfackler
Copy link
Member

It's a decently common idiom to stub out something with things like

fn foo() -> Bar {
    unimplemented!();
}

@ghost ghost added the A-type-system Area: Type system label Oct 11, 2014
@thestinger
Copy link
Contributor

@sfackler: It makes sense for the compiler to warn about a stubbed out function. It's a reminder that you should fix it before making a release.

@kmcallister
Copy link
Contributor

Trait impls should be exempted, though, since their types are imposed externally.

@ghost ghost self-assigned this Nov 11, 2014
@nham
Copy link
Contributor

nham commented May 13, 2015

Triage: still an issue (rustc 1.1.0-nightly (4b88e8f63 2015-05-11) (built 2015-05-12))

FYI the updated code is:

fn f() -> isize {
  panic!("f")
}

fn main() {
  f();
}

@ghost
Copy link

ghost commented Nov 9, 2015

@Manishearth does clippy offer this?

@Manishearth
Copy link
Member

@Toby-s No, but file a bug. Given that there are some common patterns that encourage this, I'd prefer it to be a pedantic lint (off by default)

@steveklabnik
Copy link
Member

Since new lints have a big impact on users of rustc, the policy is that they should go through the RFC process like other user-facing changes. As such, I'm going to give this one a close, but if anyone comes across this ticket and wants this lint, consider adding it to clippy and/or writing up an RFC. Thanks!

bors added a commit to rust-lang-ci/rust that referenced this issue May 30, 2024
…ls, r=y21

feat: `Quick Fix` for `bare URLs`

closes rust-lang#12835.

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: [`clippy::doc_markdown`]: `Quick Fix` for `bare URLs`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-type-system Area: Type system
Projects
None yet
Development

No branches or pull requests

8 participants