Skip to content

Commit e2ce4f9

Browse files
committed
Combine internal features in clippy_lints
1 parent 16d8488 commit e2ce4f9

File tree

14 files changed

+39
-45
lines changed

14 files changed

+39
-45
lines changed

.cargo/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
uitest = "test --test compile-test"
33
dev = "run --package clippy_dev --bin clippy_dev --manifest-path clippy_dev/Cargo.toml --"
44
lintcheck = "run --package lintcheck --bin lintcheck --manifest-path lintcheck/Cargo.toml -- "
5-
collect-metadata = "test --test dogfood --features metadata-collector-lint -- run_metadata_collection_lint --ignored"
5+
collect-metadata = "test --test dogfood --features internal -- run_metadata_collection_lint --ignored"
66

77
[build]
88
# -Zbinary-dep-depinfo allows us to track which rlib files to use for compiling UI tests

.github/workflows/clippy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ jobs:
4949
echo "LD_LIBRARY_PATH=${SYSROOT}/lib${LD_LIBRARY_PATH+:${LD_LIBRARY_PATH}}" >> $GITHUB_ENV
5050
5151
- name: Build
52-
run: cargo build --features deny-warnings,internal-lints,metadata-collector-lint
52+
run: cargo build --features deny-warnings,internal
5353

5454
- name: Test
55-
run: cargo test --features deny-warnings,internal-lints,metadata-collector-lint
55+
run: cargo test --features deny-warnings,internal
5656

5757
- name: Test clippy_lints
58-
run: cargo test --features deny-warnings,internal-lints,metadata-collector-lint
58+
run: cargo test --features deny-warnings,internal
5959
working-directory: clippy_lints
6060

6161
- name: Test clippy_utils

.github/workflows/clippy_bors.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ jobs:
112112
echo "$SYSROOT/bin" >> $GITHUB_PATH
113113
114114
- name: Build
115-
run: cargo build --features deny-warnings,internal-lints,metadata-collector-lint
115+
run: cargo build --features deny-warnings,internal
116116

117117
- name: Test
118-
run: cargo test --features deny-warnings,internal-lints,metadata-collector-lint
118+
run: cargo test --features deny-warnings,internal
119119

120120
- name: Test clippy_lints
121-
run: cargo test --features deny-warnings,internal-lints,metadata-collector-lint
121+
run: cargo test --features deny-warnings,internal
122122
working-directory: clippy_lints
123123

124124
- name: Test clippy_utils

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ rustc_tools_util = { version = "0.2", path = "rustc_tools_util" }
5757
[features]
5858
deny-warnings = ["clippy_lints/deny-warnings"]
5959
integration = ["tempfile"]
60-
internal-lints = ["clippy_lints/internal-lints"]
61-
metadata-collector-lint = ["internal-lints", "clippy_lints/metadata-collector-lint"]
60+
internal = ["clippy_lints/internal"]
6261

6362
[package.metadata.rust-analyzer]
6463
# This package uses #[feature(rustc_private)]

clippy_dev/src/update_lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ fn gen_register_lint_list<'a>(
321321

322322
for (is_public, module_name, lint_name) in details {
323323
if !is_public {
324-
output.push_str(" #[cfg(feature = \"internal-lints\")]\n");
324+
output.push_str(" #[cfg(feature = \"internal\")]\n");
325325
}
326326
output.push_str(&format!(" {}::{},\n", module_name, lint_name));
327327
}

clippy_lints/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ url = { version = "2.2", features = ["serde"] }
3030
[features]
3131
deny-warnings = ["clippy_utils/deny-warnings"]
3232
# build clippy with internal lints enabled, off by default
33-
internal-lints = ["clippy_utils/internal"]
34-
metadata-collector-lint = ["serde_json", "clippy_utils/internal"]
33+
internal = ["clippy_utils/internal", "serde_json"]
3534

3635
[package.metadata.rust-analyzer]
3736
# This crate uses #[feature(rustc_private)]

clippy_lints/src/lib.register_lints.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,33 @@
33
// Manual edits will be overwritten.
44

55
store.register_lints(&[
6-
#[cfg(feature = "internal-lints")]
6+
#[cfg(feature = "internal")]
77
utils::internal_lints::CLIPPY_LINTS_INTERNAL,
8-
#[cfg(feature = "internal-lints")]
8+
#[cfg(feature = "internal")]
99
utils::internal_lints::COLLAPSIBLE_SPAN_LINT_CALLS,
10-
#[cfg(feature = "internal-lints")]
10+
#[cfg(feature = "internal")]
1111
utils::internal_lints::COMPILER_LINT_FUNCTIONS,
12-
#[cfg(feature = "internal-lints")]
12+
#[cfg(feature = "internal")]
1313
utils::internal_lints::DEFAULT_LINT,
14-
#[cfg(feature = "internal-lints")]
14+
#[cfg(feature = "internal")]
1515
utils::internal_lints::IF_CHAIN_STYLE,
16-
#[cfg(feature = "internal-lints")]
16+
#[cfg(feature = "internal")]
1717
utils::internal_lints::INTERNING_DEFINED_SYMBOL,
18-
#[cfg(feature = "internal-lints")]
18+
#[cfg(feature = "internal")]
1919
utils::internal_lints::INVALID_CLIPPY_VERSION_ATTRIBUTE,
20-
#[cfg(feature = "internal-lints")]
20+
#[cfg(feature = "internal")]
2121
utils::internal_lints::INVALID_PATHS,
22-
#[cfg(feature = "internal-lints")]
22+
#[cfg(feature = "internal")]
2323
utils::internal_lints::LINT_WITHOUT_LINT_PASS,
24-
#[cfg(feature = "internal-lints")]
24+
#[cfg(feature = "internal")]
2525
utils::internal_lints::MATCH_TYPE_ON_DIAGNOSTIC_ITEM,
26-
#[cfg(feature = "internal-lints")]
26+
#[cfg(feature = "internal")]
2727
utils::internal_lints::MISSING_CLIPPY_VERSION_ATTRIBUTE,
28-
#[cfg(feature = "internal-lints")]
28+
#[cfg(feature = "internal")]
2929
utils::internal_lints::OUTER_EXPN_EXPN_DATA,
30-
#[cfg(feature = "internal-lints")]
30+
#[cfg(feature = "internal")]
3131
utils::internal_lints::PRODUCE_ICE,
32-
#[cfg(feature = "internal-lints")]
32+
#[cfg(feature = "internal")]
3333
utils::internal_lints::UNNECESSARY_SYMBOL_STR,
3434
absurd_extreme_comparisons::ABSURD_EXTREME_COMPARISONS,
3535
approx_const::APPROX_CONSTANT,

clippy_lints/src/lib.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,9 @@ macro_rules! declare_clippy_lint {
153153
};
154154
}
155155

156-
#[cfg(feature = "metadata-collector-lint")]
156+
#[cfg(feature = "internal")]
157157
mod deprecated_lints;
158-
#[cfg_attr(
159-
any(feature = "internal-lints", feature = "metadata-collector-lint"),
160-
allow(clippy::missing_clippy_version_attribute)
161-
)]
158+
#[cfg_attr(feature = "internal", allow(clippy::missing_clippy_version_attribute))]
162159
mod utils;
163160

164161
// begin lints modules, do not remove this comment, it’s used in `update_lints`
@@ -472,7 +469,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
472469
include!("lib.register_restriction.rs");
473470
include!("lib.register_pedantic.rs");
474471

475-
#[cfg(feature = "internal-lints")]
472+
#[cfg(feature = "internal")]
476473
include!("lib.register_internal.rs");
477474

478475
include!("lib.register_all.rs");
@@ -484,7 +481,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
484481
include!("lib.register_cargo.rs");
485482
include!("lib.register_nursery.rs");
486483

487-
#[cfg(feature = "metadata-collector-lint")]
484+
#[cfg(feature = "internal")]
488485
{
489486
if std::env::var("ENABLE_METADATA_COLLECTION").eq(&Ok("1".to_string())) {
490487
store.register_late_pass(|| Box::new(utils::internal_lints::metadata_collector::MetadataCollector::new()));
@@ -493,7 +490,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
493490
}
494491

495492
// all the internal lints
496-
#[cfg(feature = "internal-lints")]
493+
#[cfg(feature = "internal")]
497494
{
498495
store.register_early_pass(|| Box::new(utils::internal_lints::ClippyLintsInternal));
499496
store.register_early_pass(|| Box::new(utils::internal_lints::ProduceIce));

clippy_lints/src/utils/conf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ macro_rules! define_Conf {
113113
}
114114
}
115115

116-
#[cfg(feature = "metadata-collector-lint")]
116+
#[cfg(feature = "internal")]
117117
pub mod metadata {
118118
use crate::utils::internal_lints::metadata_collector::ClippyConfiguration;
119119

clippy_lints/src/utils/internal_lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use rustc_typeck::hir_ty_to_ty;
3535

3636
use std::borrow::{Borrow, Cow};
3737

38-
#[cfg(feature = "metadata-collector-lint")]
38+
#[cfg(feature = "internal")]
3939
pub mod metadata_collector;
4040

4141
declare_clippy_lint! {

clippy_lints/src/utils/internal_lints/metadata_collector.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
//! This lint is used to collect metadata about clippy lints. This metadata is exported as a json
22
//! file and then used to generate the [clippy lint list](https://rust-lang.github.io/rust-clippy/master/index.html)
33
//!
4-
//! This module and therefor the entire lint is guarded by a feature flag called
5-
//! `metadata-collector-lint`
4+
//! This module and therefore the entire lint is guarded by a feature flag called `internal`
65
//!
76
//! The module transforms all lint names to ascii lowercase to ensure that we don't have mismatches
87
//! during any comparison or mapping. (Please take care of this, it's not fun to spend time on such

clippy_lints/src/utils/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pub mod author;
22
pub mod conf;
33
pub mod inspector;
4-
#[cfg(any(feature = "internal-lints", feature = "metadata-collector-lint"))]
4+
#[cfg(feature = "internal")]
55
pub mod internal_lints;

tests/compile-test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::path::{Path, PathBuf};
1515
mod cargo;
1616

1717
// whether to run internal tests or not
18-
const RUN_INTERNAL_TESTS: bool = cfg!(feature = "internal-lints");
18+
const RUN_INTERNAL_TESTS: bool = cfg!(feature = "internal");
1919

2020
/// All crates used in UI tests are listed here
2121
static TEST_DEPENDENCIES: &[&str] = &[

tests/dogfood.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ fn dogfood_clippy() {
4242
.args(&["-D", "clippy::pedantic"])
4343
.arg("-Cdebuginfo=0"); // disable debuginfo to generate less data in the target dir
4444

45-
// internal lints only exist if we build with the internal-lints feature
46-
if cfg!(feature = "internal-lints") {
45+
// internal lints only exist if we build with the internal feature
46+
if cfg!(feature = "internal") {
4747
command.args(&["-D", "clippy::internal"]);
4848
}
4949

@@ -180,7 +180,7 @@ fn dogfood_subprojects() {
180180

181181
#[test]
182182
#[ignore]
183-
#[cfg(feature = "metadata-collector-lint")]
183+
#[cfg(feature = "internal")]
184184
fn run_metadata_collection_lint() {
185185
use std::fs::File;
186186
use std::time::SystemTime;
@@ -233,8 +233,8 @@ fn run_clippy_for_project(project: &str) {
233233
.args(&["-D", "clippy::pedantic"])
234234
.arg("-Cdebuginfo=0"); // disable debuginfo to generate less data in the target dir
235235

236-
// internal lints only exist if we build with the internal-lints feature
237-
if cfg!(feature = "internal-lints") {
236+
// internal lints only exist if we build with the internal feature
237+
if cfg!(feature = "internal") {
238238
command.args(&["-D", "clippy::internal"]);
239239
}
240240

0 commit comments

Comments
 (0)