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

Lint warning names should be more consistent #16545

Closed
rusty-nail opened this issue Aug 17, 2014 · 6 comments
Closed

Lint warning names should be more consistent #16545

rusty-nail opened this issue Aug 17, 2014 · 6 comments
Assignees
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut.
Milestone

Comments

@rusty-nail
Copy link

I noticed some inconsistencies in the naming of compiler warnings. For example, compare:

#[allow(unused_variable)]
#[allow(unused_imports)]
#[allow(unused_attribute)]
#[allow(non_snake_case_functions)]
#[allow(uppercase_variables)]

This jumps back and forth between singular and plural. uppercase also feels a bit inconsistent with snake_case and camel_case, but it's less clear-cut. Maybe non_snakecase_functions would make the grouping more obvious than non_snake_case_functions, to avoid the parse error "non-snake case-functions".

Perhaps part of the reason for the inconsistency is that the warning names are scattered across lint/builtin.rs, which doesn't make it easy for contributors to have a global view in mind.

@steveklabnik
Copy link
Member

/cc @aturon

@aturon aturon added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. and removed A-libs labels Sep 24, 2014
@aturon
Copy link
Member

aturon commented Sep 24, 2014

Nominating for 1.0, P-backcompat-lang. We do not have stability attributes on lints, and so when we hit 1.0 the names of these lints are effectively locked down.

This should be easy to resolve by writing up a short conventions RFC and then implementing it. Needs to happen soon, though.

@aturon
Copy link
Member

aturon commented Sep 24, 2014

(This might be P-backcompat-libs instead, depending on how you categorize lints.)

@pnkfelix
Copy link
Member

Assigning P-backcompat-lang, 1.0.

@pnkfelix pnkfelix added this to the 1.0 milestone Sep 25, 2014
@pcwalton
Copy link
Contributor

pcwalton commented Oct 9, 2014

@aturon Any progress on this?

@aturon
Copy link
Member

aturon commented Oct 9, 2014

@pcwalton This was included in a broad conventions RFC that I intend to bring to the weekly meeting next week.

I will have a PR resolving this issue ready to merge as soon as the RFC is accepted.

bors added a commit that referenced this issue Oct 15, 2014
[RFC 344](rust-lang/rfcs#344) proposes a set of naming conventions for lints. This PR
renames existing lints to follow the conventions.

Use the following sed script to bring your code up to date:

```
s/unnecessary_typecast/unused_typecasts/g
s/unsigned_negate/unsigned_negation/g
s/type_limits/unused_comparisons/g
s/type_overflow/overflowing_literals/g
s/ctypes/improper_ctypes/g
s/owned_heap_memory/box_pointers/g
s/unused_attribute/unused_attributes/g
s/path_statement/path_statements/g
s/unused_must_use/unused_must_use/g
s/unused_result/unused_results/g
s/non_uppercase_statics/non_upper_case_globals/g
s/unnecessary_parens/unused_parens/g
s/unnecessary_import_braces/unused_import_braces/g
s/unused_unsafe/unused_unsafe/g
s/unsafe_block/unsafe_blocks/g
s/unused_mut/unused_mut/g
s/unnecessary_allocation/unused_allocation/g
s/missing_doc/missing_docs/g
s/unused_imports/unused_imports/g
s/unused_extern_crate/unused_extern_crates/g
s/unnecessary_qualification/unused_qualifications/g
s/unrecognized_lint/unknown_lints/g
s/unused_variable/unused_variables/g
s/dead_assignment/unused_assignments/g
s/unknown_crate_type/unknown_crate_types/g
s/variant_size_difference/variant_size_differences/g
s/transmute_fat_ptr/fat_ptr_transmutes/g
```

Since a large number of lints are being renamed for RFC 344, this PR
adds some basic deprecation/renaming functionality to the pluggable lint
system. It allows a simple mapping of old to new names, and can warn
when old names are being used.

This change needs to be rolled out in stages. In this PR, the
deprecation warning is commented out, but the old name is forwarded to
the new one.

Once the PR lands and we have generated a new snapshot of the
compiler, we can add the deprecation warning and rename all uses of the
lints in the rust codebase. I will file a PR to do so.

Closes #16545
Closes #17932

r? @pcwalton
@aturon aturon closed this as completed in aabb6e7 Oct 15, 2014
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 18, 2024
…ykril

fix: Fix target layout fetching

rust-lang/rust-analyzer#16537 broke this, as `cargo rustc` cannot run against a virtual workspace, so it will always fail in such projects (like rust-analyzer itself). This brings back the plain rustc fallback,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants