From e7d4b156440abd9e8d4aa6946ac6ccd146c8f9da Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 10 Jan 2025 11:08:39 -0800 Subject: [PATCH 1/7] Add workspace deps --- components/calendar/Cargo.toml | 4 ++++ components/casemap/Cargo.toml | 4 ++++ components/collator/Cargo.toml | 4 ++++ components/collator/fuzz/Cargo.toml | 4 ++++ components/collections/Cargo.toml | 4 ++++ components/collections/codepointtrie_builder/Cargo.toml | 4 ++++ components/datetime/Cargo.toml | 4 ++++ components/decimal/Cargo.toml | 4 ++++ components/experimental/Cargo.toml | 4 ++++ components/icu/Cargo.toml | 4 ++++ components/list/Cargo.toml | 4 ++++ components/locale/Cargo.toml | 4 ++++ components/locale_core/Cargo.toml | 4 ++++ components/normalizer/Cargo.toml | 5 ++++- components/normalizer/fuzz/Cargo.toml | 4 ++++ components/pattern/Cargo.toml | 4 ++++ components/plurals/Cargo.toml | 4 ++++ components/properties/Cargo.toml | 4 ++++ components/segmenter/Cargo.toml | 4 ++++ components/timezone/Cargo.toml | 4 ++++ provider/adapters/Cargo.toml | 4 ++++ provider/baked/Cargo.toml | 4 ++++ provider/blob/Cargo.toml | 4 ++++ provider/core/Cargo.toml | 4 ++++ provider/core/macros/Cargo.toml | 4 ++++ provider/export/Cargo.toml | 4 ++++ provider/fs/Cargo.toml | 4 ++++ provider/icu4x-datagen/Cargo.toml | 4 ++++ provider/registry/Cargo.toml | 4 ++++ provider/source/Cargo.toml | 4 ++++ utils/bies/Cargo.toml | 4 ++++ utils/calendrical_calculations/Cargo.toml | 4 ++++ utils/crlify/Cargo.toml | 4 ++++ utils/databake/Cargo.toml | 4 ++++ utils/databake/derive/Cargo.toml | 4 ++++ utils/deduplicating_array/Cargo.toml | 4 ++++ utils/env_preferences/Cargo.toml | 4 ++++ utils/fixed_decimal/Cargo.toml | 5 ++++- utils/ixdtf/Cargo.toml | 4 ++++ utils/litemap/Cargo.toml | 4 ++++ utils/potential_utf/Cargo.toml | 4 ++++ utils/resb/Cargo.toml | 4 ++++ utils/tinystr/Cargo.toml | 4 ++++ utils/tzif/Cargo.toml | 4 ++++ utils/writeable/Cargo.toml | 4 ++++ utils/yoke/Cargo.toml | 4 ++++ utils/yoke/derive/Cargo.toml | 4 ++++ utils/zerofrom/Cargo.toml | 4 ++++ utils/zerofrom/derive/Cargo.toml | 4 ++++ utils/zerotrie/Cargo.toml | 4 ++++ utils/zerovec/Cargo.toml | 4 ++++ utils/zerovec/derive/Cargo.toml | 4 ++++ 52 files changed, 208 insertions(+), 2 deletions(-) diff --git a/components/calendar/Cargo.toml b/components/calendar/Cargo.toml index 96db50a1770..c943f848107 100644 --- a/components/calendar/Cargo.toml +++ b/components/calendar/Cargo.toml @@ -77,3 +77,7 @@ name = "iso_date_manipulations" [[example]] name = "iso_datetime_manipulations" + + +[lints] +workspace = true diff --git a/components/casemap/Cargo.toml b/components/casemap/Cargo.toml index 945f0dcc3bb..f4178e8132f 100644 --- a/components/casemap/Cargo.toml +++ b/components/casemap/Cargo.toml @@ -70,3 +70,7 @@ required-features = ["compiled_data", "datagen"] # datagen bound can be removed name = "casemap" harness = false required-features = ["compiled_data"] + + +[lints] +workspace = true diff --git a/components/collator/Cargo.toml b/components/collator/Cargo.toml index d0d83defd15..c1c02aa5c0a 100644 --- a/components/collator/Cargo.toml +++ b/components/collator/Cargo.toml @@ -56,3 +56,7 @@ compiled_data = ["dep:icu_collator_data", "icu_normalizer/compiled_data"] [[bench]] name = "bench" harness = false + + +[lints] +workspace = true diff --git a/components/collator/fuzz/Cargo.toml b/components/collator/fuzz/Cargo.toml index 96e3d6a6f63..6c5550243f8 100644 --- a/components/collator/fuzz/Cargo.toml +++ b/components/collator/fuzz/Cargo.toml @@ -30,3 +30,7 @@ name = "compare_utf16" path = "fuzz_targets/compare_utf16.rs" test = false doc = false + + +[lints] +workspace = true diff --git a/components/collections/Cargo.toml b/components/collections/Cargo.toml index 48fb6b678e9..2da9acfc79e 100644 --- a/components/collections/Cargo.toml +++ b/components/collections/Cargo.toml @@ -71,3 +71,7 @@ path = "benches/iai_cpt.rs" name = "inv_list" harness = false path = "benches/inv_list.rs" + + +[lints] +workspace = true diff --git a/components/collections/codepointtrie_builder/Cargo.toml b/components/collections/codepointtrie_builder/Cargo.toml index 5d812113ae1..797ccdbd815 100644 --- a/components/collections/codepointtrie_builder/Cargo.toml +++ b/components/collections/codepointtrie_builder/Cargo.toml @@ -54,3 +54,7 @@ denylist = ["icu4c"] [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(icu4c_enable_renaming)'] } + + +[lints] +workspace = true diff --git a/components/datetime/Cargo.toml b/components/datetime/Cargo.toml index fc81c995966..44079546ac1 100644 --- a/components/datetime/Cargo.toml +++ b/components/datetime/Cargo.toml @@ -140,3 +140,7 @@ required-features = ["experimental"] [[example]] name = "work_log" required-features = ["compiled_data"] + + +[lints] +workspace = true diff --git a/components/decimal/Cargo.toml b/components/decimal/Cargo.toml index 2fd71cc1edc..5de0a0cd23b 100644 --- a/components/decimal/Cargo.toml +++ b/components/decimal/Cargo.toml @@ -66,3 +66,7 @@ harness = false [[example]] name = "code_line_diff" required-features = ["serde"] + + +[lints] +workspace = true diff --git a/components/experimental/Cargo.toml b/components/experimental/Cargo.toml index 81ba78bb502..d4d62eae7d3 100644 --- a/components/experimental/Cargo.toml +++ b/components/experimental/Cargo.toml @@ -106,3 +106,7 @@ path = "tests/transliterate/lower_ascii.rs" [[test]] name = "units_test" path = "tests/units/units_test.rs" + + +[lints] +workspace = true diff --git a/components/icu/Cargo.toml b/components/icu/Cargo.toml index 3a8dba46688..adc1201de51 100644 --- a/components/icu/Cargo.toml +++ b/components/icu/Cargo.toml @@ -152,3 +152,7 @@ skip_feature_sets = [[]] [[example]] name = "tui" required-features = ["serde"] + + +[lints] +workspace = true diff --git a/components/list/Cargo.toml b/components/list/Cargo.toml index d0517e3ed3f..2ad802cf5fb 100644 --- a/components/list/Cargo.toml +++ b/components/list/Cargo.toml @@ -52,3 +52,7 @@ denylist = ["bench"] [[example]] name = "and_list" + + +[lints] +workspace = true diff --git a/components/locale/Cargo.toml b/components/locale/Cargo.toml index 9f99f637271..4b116349ef4 100644 --- a/components/locale/Cargo.toml +++ b/components/locale/Cargo.toml @@ -65,3 +65,7 @@ harness = false [[test]] name = "locale_canonicalizer" required-features = ["serde"] + + +[lints] +workspace = true diff --git a/components/locale_core/Cargo.toml b/components/locale_core/Cargo.toml index 7b5aa8d4411..539dd1ee61d 100644 --- a/components/locale_core/Cargo.toml +++ b/components/locale_core/Cargo.toml @@ -83,3 +83,7 @@ test = true [[example]] name = "syntatically_canonicalize_locales" test = true + + +[lints] +workspace = true diff --git a/components/normalizer/Cargo.toml b/components/normalizer/Cargo.toml index c037959a840..2b059c212b5 100644 --- a/components/normalizer/Cargo.toml +++ b/components/normalizer/Cargo.toml @@ -65,4 +65,7 @@ utf8_iter = ["dep:utf8_iter"] [[bench]] name = "bench" harness = false -required_features = ["utf16_iter", "utf8_iter"] \ No newline at end of file +required_features = ["utf16_iter", "utf8_iter"] + +[lints] +workspace = true diff --git a/components/normalizer/fuzz/Cargo.toml b/components/normalizer/fuzz/Cargo.toml index dae34232279..5eea1841d54 100644 --- a/components/normalizer/fuzz/Cargo.toml +++ b/components/normalizer/fuzz/Cargo.toml @@ -35,3 +35,7 @@ name = "compare_self" path = "fuzz_targets/compare_self.rs" test = false doc = false + + +[lints] +workspace = true diff --git a/components/pattern/Cargo.toml b/components/pattern/Cargo.toml index bb8f681064e..cd2b3095ab6 100644 --- a/components/pattern/Cargo.toml +++ b/components/pattern/Cargo.toml @@ -46,3 +46,7 @@ litemap = ["dep:litemap"] serde = ["alloc", "dep:serde"] yoke = ["dep:yoke"] zerovec = ["dep:zerovec"] + + +[lints] +workspace = true diff --git a/components/plurals/Cargo.toml b/components/plurals/Cargo.toml index c961d6ca42f..93d96c4eba1 100644 --- a/components/plurals/Cargo.toml +++ b/components/plurals/Cargo.toml @@ -90,3 +90,7 @@ required-features = ["serde"] [[example]] name = "elevator_floors" required-features = ["serde"] + + +[lints] +workspace = true diff --git a/components/properties/Cargo.toml b/components/properties/Cargo.toml index 0f9c4fd99fe..a544dd76bdb 100644 --- a/components/properties/Cargo.toml +++ b/components/properties/Cargo.toml @@ -44,3 +44,7 @@ serde = ["dep:serde", "icu_locale_core/serde", "potential_utf/serde", "zerovec/s datagen = ["serde", "dep:databake", "potential_utf/databake", "zerovec/databake", "icu_collections/databake", "icu_locale_core/databake", "zerotrie/databake"] unicode_bidi = [ "dep:unicode-bidi" ] compiled_data = ["dep:icu_properties_data"] + + +[lints] +workspace = true diff --git a/components/segmenter/Cargo.toml b/components/segmenter/Cargo.toml index 5f73cef2ab5..3c5c832a129 100644 --- a/components/segmenter/Cargo.toml +++ b/components/segmenter/Cargo.toml @@ -65,3 +65,7 @@ harness = false [[test]] name = "complex_word" required-features = ["auto"] + + +[lints] +workspace = true diff --git a/components/timezone/Cargo.toml b/components/timezone/Cargo.toml index 58a44541154..38e87c45817 100644 --- a/components/timezone/Cargo.toml +++ b/components/timezone/Cargo.toml @@ -45,3 +45,7 @@ std = ["icu_calendar/std", "icu_provider/std"] serde = ["dep:serde", "zerovec/serde", "zerotrie/serde", "tinystr/serde", "icu_provider/serde"] datagen = ["serde", "dep:databake", "zerovec/databake", "zerotrie/databake", "tinystr/databake"] compiled_data = ["dep:icu_timezone_data", "icu_calendar/compiled_data"] + + +[lints] +workspace = true diff --git a/provider/adapters/Cargo.toml b/provider/adapters/Cargo.toml index d744881f761..f5d1173c3fb 100644 --- a/provider/adapters/Cargo.toml +++ b/provider/adapters/Cargo.toml @@ -33,3 +33,7 @@ writeable = { path = "../../utils/writeable" } [features] std = [] export = ["icu_provider/export", "std"] + + +[lints] +workspace = true diff --git a/provider/baked/Cargo.toml b/provider/baked/Cargo.toml index c99d89dd407..ad46695263e 100644 --- a/provider/baked/Cargo.toml +++ b/provider/baked/Cargo.toml @@ -43,3 +43,7 @@ export = [ "icu_provider/export", "zerotrie/databake", ] + + +[lints] +workspace = true diff --git a/provider/blob/Cargo.toml b/provider/blob/Cargo.toml index b70a2b90645..e31606ebadd 100644 --- a/provider/blob/Cargo.toml +++ b/provider/blob/Cargo.toml @@ -61,3 +61,7 @@ required-features = ["export"] [[bench]] name = "blob_version_bench" harness = false + + +[lints] +workspace = true diff --git a/provider/core/Cargo.toml b/provider/core/Cargo.toml index e48a74297e0..211dad62151 100644 --- a/provider/core/Cargo.toml +++ b/provider/core/Cargo.toml @@ -84,3 +84,7 @@ bench = false # This option is required for Benchmark CI [[bench]] name = "data_locale_bench" harness = false + + +[lints] +workspace = true diff --git a/provider/core/macros/Cargo.toml b/provider/core/macros/Cargo.toml index 803fea1ea4c..8b29b6f9494 100644 --- a/provider/core/macros/Cargo.toml +++ b/provider/core/macros/Cargo.toml @@ -27,3 +27,7 @@ syn = { workspace = true } [dev-dependencies] icu_provider = { path = "..", features = ["macros"] } + + +[lints] +workspace = true diff --git a/provider/export/Cargo.toml b/provider/export/Cargo.toml index 29acc04db56..629357bc790 100644 --- a/provider/export/Cargo.toml +++ b/provider/export/Cargo.toml @@ -58,3 +58,7 @@ baked_exporter = ["dep:icu_provider_baked"] blob_exporter = ["dep:icu_provider_blob"] fs_exporter = ["dep:icu_provider_fs"] rayon = ["dep:rayon"] + + +[lints] +workspace = true diff --git a/provider/fs/Cargo.toml b/provider/fs/Cargo.toml index 785f70313bf..0b24a5dfd79 100644 --- a/provider/fs/Cargo.toml +++ b/provider/fs/Cargo.toml @@ -64,3 +64,7 @@ denylist = ["bench"] [[bench]] name = "provider_fs" harness = false + + +[lints] +workspace = true diff --git a/provider/icu4x-datagen/Cargo.toml b/provider/icu4x-datagen/Cargo.toml index 9172de2a53e..4a680140e52 100644 --- a/provider/icu4x-datagen/Cargo.toml +++ b/provider/icu4x-datagen/Cargo.toml @@ -53,3 +53,7 @@ skip_feature_sets = [["use_icu4c"], ["use_wasm"]] skip_optional_dependencies = true # We have a *lot* of features here max_combination_size = 2 + + +[lints] +workspace = true diff --git a/provider/registry/Cargo.toml b/provider/registry/Cargo.toml index 66ec92d74a1..a1e402cded4 100644 --- a/provider/registry/Cargo.toml +++ b/provider/registry/Cargo.toml @@ -18,3 +18,7 @@ include.workspace = true [dev-dependencies] icu = { path = "../../components/icu", features = ["experimental"] } icu_provider = { workspace = true } + + +[lints] +workspace = true diff --git a/provider/source/Cargo.toml b/provider/source/Cargo.toml index e9c8277458a..b8bbcafdc41 100644 --- a/provider/source/Cargo.toml +++ b/provider/source/Cargo.toml @@ -101,3 +101,7 @@ experimental = [ [package.metadata.cargo-all-features] # We don't need working CPT builders for check skip_feature_sets = [["use_icu4c"], ["use_wasm"]] + + +[lints] +workspace = true diff --git a/utils/bies/Cargo.toml b/utils/bies/Cargo.toml index 0e2a93ef7f7..4b1a62b5016 100644 --- a/utils/bies/Cargo.toml +++ b/utils/bies/Cargo.toml @@ -31,3 +31,7 @@ writeable = { workspace = true } rand = { workspace = true } rand_distr = { workspace = true } rand_pcg = { workspace = true } + + +[lints] +workspace = true diff --git a/utils/calendrical_calculations/Cargo.toml b/utils/calendrical_calculations/Cargo.toml index 68f57c165e1..26b98ac3616 100644 --- a/utils/calendrical_calculations/Cargo.toml +++ b/utils/calendrical_calculations/Cargo.toml @@ -43,3 +43,7 @@ std = [] [package.metadata.cargo-all-features] # Bench feature gets tested separately and is only relevant for CI denylist = ["bench"] + + +[lints] +workspace = true diff --git a/utils/crlify/Cargo.toml b/utils/crlify/Cargo.toml index 548a84a800f..7586b6db654 100644 --- a/utils/crlify/Cargo.toml +++ b/utils/crlify/Cargo.toml @@ -18,3 +18,7 @@ rust-version.workspace = true [package.metadata.workspaces] independent = true + + +[lints] +workspace = true diff --git a/utils/databake/Cargo.toml b/utils/databake/Cargo.toml index 7f0a0c18055..5829e9981c5 100644 --- a/utils/databake/Cargo.toml +++ b/utils/databake/Cargo.toml @@ -29,3 +29,7 @@ derive = ["dep:databake-derive"] proc-macro2 = { workspace = true } quote = { workspace = true } databake-derive = { workspace = true, optional = true} + + +[lints] +workspace = true diff --git a/utils/databake/derive/Cargo.toml b/utils/databake/derive/Cargo.toml index 4a68fb5fb49..12e40559f87 100644 --- a/utils/databake/derive/Cargo.toml +++ b/utils/databake/derive/Cargo.toml @@ -31,3 +31,7 @@ synstructure = { workspace = true } [dev-dependencies] databake = { path = "..", features = ["derive"]} + + +[lints] +workspace = true diff --git a/utils/deduplicating_array/Cargo.toml b/utils/deduplicating_array/Cargo.toml index 92780bbd3aa..7ffb12b858a 100644 --- a/utils/deduplicating_array/Cargo.toml +++ b/utils/deduplicating_array/Cargo.toml @@ -26,3 +26,7 @@ postcard = { workspace = true, features = ["alloc"] } [[example]] name = "postcard" + + +[lints] +workspace = true diff --git a/utils/env_preferences/Cargo.toml b/utils/env_preferences/Cargo.toml index fe9021db91e..caf57ff21ab 100644 --- a/utils/env_preferences/Cargo.toml +++ b/utils/env_preferences/Cargo.toml @@ -35,3 +35,7 @@ features = [ [dev-dependencies] icu_locale = { path = "../../components/locale" } + + +[lints] +workspace = true diff --git a/utils/fixed_decimal/Cargo.toml b/utils/fixed_decimal/Cargo.toml index ef223c72313..d5220b58fc3 100644 --- a/utils/fixed_decimal/Cargo.toml +++ b/utils/fixed_decimal/Cargo.toml @@ -53,4 +53,7 @@ denylist = ["bench"] [[bench]] name = "fixed_decimal" -harness = false \ No newline at end of file +harness = false + +[lints] +workspace = true diff --git a/utils/ixdtf/Cargo.toml b/utils/ixdtf/Cargo.toml index 946b5872994..c9aa908451a 100644 --- a/utils/ixdtf/Cargo.toml +++ b/utils/ixdtf/Cargo.toml @@ -35,3 +35,7 @@ serde-json-core = { workspace = true, features = ["std"] } [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] criterion = { workspace = true } + + +[lints] +workspace = true diff --git a/utils/litemap/Cargo.toml b/utils/litemap/Cargo.toml index c83d3004eee..02cd35e6a0d 100644 --- a/utils/litemap/Cargo.toml +++ b/utils/litemap/Cargo.toml @@ -79,3 +79,7 @@ required-features = ["serde"] name = "litemap" harness = false required-features = ["serde"] + + +[lints] +workspace = true diff --git a/utils/potential_utf/Cargo.toml b/utils/potential_utf/Cargo.toml index 3dd1b5278a3..e6f1eb53eca 100644 --- a/utils/potential_utf/Cargo.toml +++ b/utils/potential_utf/Cargo.toml @@ -31,3 +31,7 @@ databake = ["dep:databake"] serde = ["dep:serde"] writeable = ["dep:writeable", "alloc"] zerovec = ["dep:zerovec", "alloc"] + + +[lints] +workspace = true diff --git a/utils/resb/Cargo.toml b/utils/resb/Cargo.toml index a10058e1bf7..c41bfb9fe73 100644 --- a/utils/resb/Cargo.toml +++ b/utils/resb/Cargo.toml @@ -50,3 +50,7 @@ required-features = ["serialize", "text"] name = "time_zone_rule" # run in `cargo test` harness = false + + +[lints] +workspace = true diff --git a/utils/tinystr/Cargo.toml b/utils/tinystr/Cargo.toml index 726e84b77db..7ec84aa92e9 100644 --- a/utils/tinystr/Cargo.toml +++ b/utils/tinystr/Cargo.toml @@ -73,3 +73,7 @@ required-features = ["bench"] name = "serde" harness = false required-features = ["bench", "serde"] + + +[lints] +workspace = true diff --git a/utils/tzif/Cargo.toml b/utils/tzif/Cargo.toml index 6cabdc5e4d8..b5db91021f5 100644 --- a/utils/tzif/Cargo.toml +++ b/utils/tzif/Cargo.toml @@ -23,3 +23,7 @@ combine = { workspace = true } [dev-dependencies] walkdir = { workspace = true } + + +[lints] +workspace = true diff --git a/utils/writeable/Cargo.toml b/utils/writeable/Cargo.toml index 508fcaa0353..d02746ea344 100644 --- a/utils/writeable/Cargo.toml +++ b/utils/writeable/Cargo.toml @@ -44,3 +44,7 @@ bench = false # This option is required for Benchmark CI [[bench]] name = "writeable" harness = false + + +[lints] +workspace = true diff --git a/utils/yoke/Cargo.toml b/utils/yoke/Cargo.toml index 57e5443977c..3c2f10e7e5a 100644 --- a/utils/yoke/Cargo.toml +++ b/utils/yoke/Cargo.toml @@ -45,3 +45,7 @@ zerofrom = { workspace = true, optional = true} bincode = { workspace = true } postcard = { workspace = true } serde = { workspace = true } + + +[lints] +workspace = true diff --git a/utils/yoke/derive/Cargo.toml b/utils/yoke/derive/Cargo.toml index adf447250e2..166cf8f54fe 100644 --- a/utils/yoke/derive/Cargo.toml +++ b/utils/yoke/derive/Cargo.toml @@ -30,3 +30,7 @@ synstructure = { workspace = true } [dev-dependencies] yoke = { path = "..", features = ["derive"] } zerovec = { path = "../../../utils/zerovec", features = ["yoke"] } + + +[lints] +workspace = true diff --git a/utils/zerofrom/Cargo.toml b/utils/zerofrom/Cargo.toml index 290d715f0e6..ac85c7dcead 100644 --- a/utils/zerofrom/Cargo.toml +++ b/utils/zerofrom/Cargo.toml @@ -29,3 +29,7 @@ default = ["alloc"] [dependencies] zerofrom-derive = { workspace = true, optional = true} + + +[lints] +workspace = true diff --git a/utils/zerofrom/derive/Cargo.toml b/utils/zerofrom/derive/Cargo.toml index 9a2cfc0a14f..1dbec6e3aa1 100644 --- a/utils/zerofrom/derive/Cargo.toml +++ b/utils/zerofrom/derive/Cargo.toml @@ -31,3 +31,7 @@ synstructure = { workspace = true } zerofrom = { path = "..", features = ["derive"]} zerovec = { path = "../../../utils/zerovec", features = ["yoke"] } + + +[lints] +workspace = true diff --git a/utils/zerotrie/Cargo.toml b/utils/zerotrie/Cargo.toml index acd1f24d917..e28b9f7e6cc 100644 --- a/utils/zerotrie/Cargo.toml +++ b/utils/zerotrie/Cargo.toml @@ -78,3 +78,7 @@ required-features = ["alloc", "litemap"] [[test]] name = "locale_aux_test" required-features = ["alloc", "litemap"] + + +[lints] +workspace = true diff --git a/utils/zerovec/Cargo.toml b/utils/zerovec/Cargo.toml index 22938566854..44fcacd8da5 100644 --- a/utils/zerovec/Cargo.toml +++ b/utils/zerovec/Cargo.toml @@ -95,3 +95,7 @@ required-features = ["serde", "hashmap", "derive"] [[example]] name = "zv_serde" required-features = ["serde"] + + +[lints] +workspace = true diff --git a/utils/zerovec/derive/Cargo.toml b/utils/zerovec/derive/Cargo.toml index 6a317d768de..b5c964d847f 100644 --- a/utils/zerovec/derive/Cargo.toml +++ b/utils/zerovec/derive/Cargo.toml @@ -47,3 +47,7 @@ test = true name = "make_var" harness = false test = true + + +[lints] +workspace = true From cb88540f95153d341ffa5f1cf14c4b66d66f2937 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 10 Jan 2025 11:13:55 -0800 Subject: [PATCH 2/7] rm boilerplate --- components/calendar/src/lib.rs | 14 +------------- components/casemap/src/lib.rs | 14 +------------- components/collator/src/lib.rs | 14 +------------- .../collections/codepointtrie_builder/src/lib.rs | 14 +------------- .../collections/src/codepointinvlist/mod.rs | 1 - components/collections/src/lib.rs | 11 +---------- components/datetime/src/lib.rs | 14 +------------- components/decimal/src/lib.rs | 14 +------------- components/experimental/src/compactdecimal/mod.rs | 14 +------------- components/experimental/src/displaynames/mod.rs | 14 +------------- components/experimental/src/duration/mod.rs | 1 - components/experimental/src/relativetime/mod.rs | 1 - components/experimental/src/transliterate/mod.rs | 14 +------------- .../experimental/src/unicodeset_parse/mod.rs | 14 +------------- components/icu/src/lib.rs | 14 +------------- components/list/src/lib.rs | 14 +------------- components/locale/src/lib.rs | 14 +------------- components/locale_core/src/lib.rs | 14 +------------- components/normalizer/src/lib.rs | 14 +------------- components/pattern/src/lib.rs | 13 +------------ components/plurals/src/lib.rs | 14 +------------- components/properties/src/lib.rs | 14 +------------- components/segmenter/src/lib.rs | 14 +------------- components/timezone/src/lib.rs | 14 +------------- provider/adapters/src/lib.rs | 14 +------------- provider/blob/src/lib.rs | 14 +------------- provider/core/macros/src/lib.rs | 15 +-------------- provider/core/src/lib.rs | 14 +------------- provider/export/src/lib.rs | 15 +-------------- provider/fs/src/lib.rs | 14 +------------- utils/calendrical_calculations/src/lib.rs | 13 +------------ utils/deduplicating_array/src/lib.rs | 13 +------------ utils/fixed_decimal/src/lib.rs | 13 +------------ utils/ixdtf/src/lib.rs | 13 +------------ utils/litemap/src/lib.rs | 13 +------------ utils/potential_utf/src/lib.rs | 13 +------------ utils/resb/src/lib.rs | 13 +------------ utils/tinystr/src/lib.rs | 13 +------------ utils/writeable/src/lib.rs | 13 +------------ utils/yoke/src/lib.rs | 13 +------------ utils/zerofrom/derive/src/lib.rs | 13 +------------ utils/zerofrom/src/lib.rs | 13 +------------ utils/zerotrie/src/lib.rs | 14 +------------- utils/zerovec/src/lib.rs | 13 +------------ 44 files changed, 41 insertions(+), 521 deletions(-) diff --git a/components/calendar/src/lib.rs b/components/calendar/src/lib.rs index dc57ea88896..787d2063930 100644 --- a/components/calendar/src/lib.rs +++ b/components/calendar/src/lib.rs @@ -95,19 +95,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + extern crate alloc; diff --git a/components/casemap/src/lib.rs b/components/casemap/src/lib.rs index 787214c0ce1..d3109a957f6 100644 --- a/components/casemap/src/lib.rs +++ b/components/casemap/src/lib.rs @@ -29,19 +29,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + // We're using Greek identifiers here on purpose. These lints can only be disabled at the crate level #![allow(confusable_idents, uncommon_codepoints)] diff --git a/components/collator/src/lib.rs b/components/collator/src/lib.rs index 5ebfb49ca8a..2222e26cb83 100644 --- a/components/collator/src/lib.rs +++ b/components/collator/src/lib.rs @@ -8,19 +8,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + //! Comparing strings according to language-dependent conventions. //! diff --git a/components/collections/codepointtrie_builder/src/lib.rs b/components/collections/codepointtrie_builder/src/lib.rs index cbcc1052dec..b24f84bcc0b 100644 --- a/components/collections/codepointtrie_builder/src/lib.rs +++ b/components/collections/codepointtrie_builder/src/lib.rs @@ -71,19 +71,7 @@ //! [`CodePointTrie`]: icu_collections::codepointtrie::CodePointTrie //! [`UMutableCPTrie`]: (https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/umutablecptrie_8h.html#ad8945cf34ca9d40596a66a1395baa19b) -#![cfg_attr( - not(test), - deny( - // The crate is documented to allow panics. - // clippy::indexing_slicing, - // clippy::unwrap_used, - // clippy::expect_used, - // clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] + use icu_collections::codepointtrie::TrieType; use icu_collections::codepointtrie::TrieValue; diff --git a/components/collections/src/codepointinvlist/mod.rs b/components/collections/src/codepointinvlist/mod.rs index 211b72e80a2..8fdfc8eeed5 100644 --- a/components/collections/src/codepointinvlist/mod.rs +++ b/components/collections/src/codepointinvlist/mod.rs @@ -51,7 +51,6 @@ //! //! [`ICU4X`]: ../icu/index.html -#![warn(missing_docs)] extern crate alloc; diff --git a/components/collections/src/lib.rs b/components/collections/src/lib.rs index 3c37fcb4052..eb68664ae60 100644 --- a/components/collections/src/lib.rs +++ b/components/collections/src/lib.rs @@ -22,16 +22,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic - ) -)] -#![warn(missing_docs)] + extern crate alloc; diff --git a/components/datetime/src/lib.rs b/components/datetime/src/lib.rs index c633dc8de07..f2e8aa9a40b 100644 --- a/components/datetime/src/lib.rs +++ b/components/datetime/src/lib.rs @@ -71,19 +71,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + extern crate alloc; diff --git a/components/decimal/src/lib.rs b/components/decimal/src/lib.rs index 15fbafe6010..274c9d4a207 100644 --- a/components/decimal/src/lib.rs +++ b/components/decimal/src/lib.rs @@ -77,19 +77,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + extern crate alloc; diff --git a/components/experimental/src/compactdecimal/mod.rs b/components/experimental/src/compactdecimal/mod.rs index 8d0e3b5cc95..2c4dab388ff 100644 --- a/components/experimental/src/compactdecimal/mod.rs +++ b/components/experimental/src/compactdecimal/mod.rs @@ -5,19 +5,7 @@ //! Compact decimal // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + mod error; mod format; diff --git a/components/experimental/src/displaynames/mod.rs b/components/experimental/src/displaynames/mod.rs index 7171e828f38..9f431cf0b1e 100644 --- a/components/experimental/src/displaynames/mod.rs +++ b/components/experimental/src/displaynames/mod.rs @@ -7,19 +7,7 @@ // TODO: expand documentation // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - // missing_debug_implementations // TBD before stabilization - ) -)] -#![warn(missing_docs)] + mod displaynames; mod options; diff --git a/components/experimental/src/duration/mod.rs b/components/experimental/src/duration/mod.rs index 755203d3bfe..7ebfe2047c0 100644 --- a/components/experimental/src/duration/mod.rs +++ b/components/experimental/src/duration/mod.rs @@ -4,7 +4,6 @@ //! Duration formatting -#![warn(missing_docs)] mod duration; mod format; diff --git a/components/experimental/src/relativetime/mod.rs b/components/experimental/src/relativetime/mod.rs index 2ca0bce9789..6486d78f164 100644 --- a/components/experimental/src/relativetime/mod.rs +++ b/components/experimental/src/relativetime/mod.rs @@ -4,7 +4,6 @@ //! Relative time formatting -#![warn(missing_docs)] mod format; pub mod options; diff --git a/components/experimental/src/transliterate/mod.rs b/components/experimental/src/transliterate/mod.rs index bfa4abba072..99ff5c51273 100644 --- a/components/experimental/src/transliterate/mod.rs +++ b/components/experimental/src/transliterate/mod.rs @@ -7,19 +7,7 @@ //! See [`Transliterator`]. // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + pub mod provider; diff --git a/components/experimental/src/unicodeset_parse/mod.rs b/components/experimental/src/unicodeset_parse/mod.rs index 37ddeb3cb80..71eb7a58b54 100644 --- a/components/experimental/src/unicodeset_parse/mod.rs +++ b/components/experimental/src/unicodeset_parse/mod.rs @@ -11,19 +11,7 @@ //! [`ICU4X`]: ../icu/index.html // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + mod parse; diff --git a/components/icu/src/lib.rs b/components/icu/src/lib.rs index 4777bc8b8f7..fca9763ef3e 100644 --- a/components/icu/src/lib.rs +++ b/components/icu/src/lib.rs @@ -128,19 +128,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + #[cfg(doc)] // Needed for intra-doc link to work, since icu_provider is otherwise never mentioned in this crate diff --git a/components/list/src/lib.rs b/components/list/src/lib.rs index 29cb8a7193d..b606168b825 100644 --- a/components/list/src/lib.rs +++ b/components/list/src/lib.rs @@ -73,19 +73,7 @@ //! for full unit handling. #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + extern crate alloc; diff --git a/components/locale/src/lib.rs b/components/locale/src/lib.rs index 5053913c48f..7c6897e4aee 100644 --- a/components/locale/src/lib.rs +++ b/components/locale/src/lib.rs @@ -70,19 +70,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + extern crate alloc; diff --git a/components/locale_core/src/lib.rs b/components/locale_core/src/lib.rs index 6344ec4a134..ae66ee222a0 100644 --- a/components/locale_core/src/lib.rs +++ b/components/locale_core/src/lib.rs @@ -50,19 +50,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + extern crate alloc; diff --git a/components/normalizer/src/lib.rs b/components/normalizer/src/lib.rs index b918c8daff8..a736d1538d8 100644 --- a/components/normalizer/src/lib.rs +++ b/components/normalizer/src/lib.rs @@ -4,19 +4,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + //! Normalizing text into Unicode Normalization Forms. //! diff --git a/components/pattern/src/lib.rs b/components/pattern/src/lib.rs index 192427adbb1..0fda0ecbfe2 100644 --- a/components/pattern/src/lib.rs +++ b/components/pattern/src/lib.rs @@ -32,18 +32,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] + #[cfg(feature = "alloc")] extern crate alloc; diff --git a/components/plurals/src/lib.rs b/components/plurals/src/lib.rs index 4cd4f3a547a..ec1d62dde42 100644 --- a/components/plurals/src/lib.rs +++ b/components/plurals/src/lib.rs @@ -59,19 +59,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + extern crate alloc; diff --git a/components/properties/src/lib.rs b/components/properties/src/lib.rs index fdbc77180b7..b0dad450b62 100644 --- a/components/properties/src/lib.rs +++ b/components/properties/src/lib.rs @@ -53,19 +53,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + extern crate alloc; diff --git a/components/segmenter/src/lib.rs b/components/segmenter/src/lib.rs index f3104e08c24..116a413c708 100644 --- a/components/segmenter/src/lib.rs +++ b/components/segmenter/src/lib.rs @@ -101,19 +101,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + extern crate alloc; diff --git a/components/timezone/src/lib.rs b/components/timezone/src/lib.rs index 945ab9a5a7c..9c8666bab58 100644 --- a/components/timezone/src/lib.rs +++ b/components/timezone/src/lib.rs @@ -84,19 +84,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + extern crate alloc; diff --git a/provider/adapters/src/lib.rs b/provider/adapters/src/lib.rs index 8b5d871d431..555ac807aaf 100644 --- a/provider/adapters/src/lib.rs +++ b/provider/adapters/src/lib.rs @@ -11,19 +11,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + extern crate alloc; diff --git a/provider/blob/src/lib.rs b/provider/blob/src/lib.rs index 738b6f23e3d..c4fb9df8bdc 100644 --- a/provider/blob/src/lib.rs +++ b/provider/blob/src/lib.rs @@ -17,19 +17,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + extern crate alloc; diff --git a/provider/core/macros/src/lib.rs b/provider/core/macros/src/lib.rs index 86c92c5c88c..3fa8e2ec537 100644 --- a/provider/core/macros/src/lib.rs +++ b/provider/core/macros/src/lib.rs @@ -3,20 +3,7 @@ // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - // Panics are OK in proc macros - // clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + //! Proc macros for the ICU4X data provider. //! diff --git a/provider/core/src/lib.rs b/provider/core/src/lib.rs index e019dd348a6..d09612c47f1 100644 --- a/provider/core/src/lib.rs +++ b/provider/core/src/lib.rs @@ -92,19 +92,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + extern crate alloc; diff --git a/provider/export/src/lib.rs b/provider/export/src/lib.rs index f819c847078..3aaad9e279f 100644 --- a/provider/export/src/lib.rs +++ b/provider/export/src/lib.rs @@ -45,20 +45,7 @@ //! * `rayon` //! * enables parallelism during export -#![cfg_attr( - not(test), - deny( - // This is a tool, and as such we don't care about panics too much - // clippy::indexing_slicing, - // clippy::unwrap_used, - // clippy::expect_used, - // clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + mod export_impl; mod locale_family; diff --git a/provider/fs/src/lib.rs b/provider/fs/src/lib.rs index 810c5a344b1..59e1f94eefb 100644 --- a/provider/fs/src/lib.rs +++ b/provider/fs/src/lib.rs @@ -77,19 +77,7 @@ //! [`ICU4X`]: ../icu/index.html // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] -#![warn(missing_docs)] + mod fs_data_provider; mod manifest; diff --git a/utils/calendrical_calculations/src/lib.rs b/utils/calendrical_calculations/src/lib.rs index 2066791f7de..f1fb0857372 100644 --- a/utils/calendrical_calculations/src/lib.rs +++ b/utils/calendrical_calculations/src/lib.rs @@ -20,18 +20,7 @@ //! to add more structure to this crate as needed. // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] + #![warn(missing_docs)] mod astronomy; diff --git a/utils/deduplicating_array/src/lib.rs b/utils/deduplicating_array/src/lib.rs index c122eb1a8d5..42a881ee222 100644 --- a/utils/deduplicating_array/src/lib.rs +++ b/utils/deduplicating_array/src/lib.rs @@ -30,18 +30,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(test), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] + extern crate alloc; diff --git a/utils/fixed_decimal/src/lib.rs b/utils/fixed_decimal/src/lib.rs index ae70deafc57..effb3b15bbc 100644 --- a/utils/fixed_decimal/src/lib.rs +++ b/utils/fixed_decimal/src/lib.rs @@ -38,18 +38,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] + mod compact; mod decimal; diff --git a/utils/ixdtf/src/lib.rs b/utils/ixdtf/src/lib.rs index 8f39111b84f..0a6eef3b61c 100644 --- a/utils/ixdtf/src/lib.rs +++ b/utils/ixdtf/src/lib.rs @@ -374,18 +374,7 @@ //! [temporal-grammar]: https://tc39.es/proposal-temporal/#sec-temporal-iso8601grammar #![no_std] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] + mod error; pub mod parsers; diff --git a/utils/litemap/src/lib.rs b/utils/litemap/src/lib.rs index f8aeb7dda29..0dd2bd7283f 100644 --- a/utils/litemap/src/lib.rs +++ b/utils/litemap/src/lib.rs @@ -32,18 +32,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(test), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] + // for intra doc links #[cfg(doc)] diff --git a/utils/potential_utf/src/lib.rs b/utils/potential_utf/src/lib.rs index 5ea72a92a40..f2b66ec5328 100644 --- a/utils/potential_utf/src/lib.rs +++ b/utils/potential_utf/src/lib.rs @@ -3,18 +3,7 @@ // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). #![cfg_attr(not(test), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] + //! A crate providing unvalidated string and character types. diff --git a/utils/resb/src/lib.rs b/utils/resb/src/lib.rs index 66404e53168..2d6a71e1624 100644 --- a/utils/resb/src/lib.rs +++ b/utils/resb/src/lib.rs @@ -12,18 +12,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] + #![warn(missing_docs)] pub mod binary; diff --git a/utils/tinystr/src/lib.rs b/utils/tinystr/src/lib.rs index ab1bfc4f0c6..8993c20ef9c 100644 --- a/utils/tinystr/src/lib.rs +++ b/utils/tinystr/src/lib.rs @@ -53,18 +53,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] + mod macros; diff --git a/utils/writeable/src/lib.rs b/utils/writeable/src/lib.rs index 48d0f52457f..04d283f3140 100644 --- a/utils/writeable/src/lib.rs +++ b/utils/writeable/src/lib.rs @@ -4,18 +4,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(all(not(test), not(doc)), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] + //! `writeable` is a utility crate of the [`ICU4X`] project. //! diff --git a/utils/yoke/src/lib.rs b/utils/yoke/src/lib.rs index 26fe9614703..03c217cf398 100644 --- a/utils/yoke/src/lib.rs +++ b/utils/yoke/src/lib.rs @@ -26,18 +26,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(all(not(test), not(doc)), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] + // The lifetimes here are important for safety and explicitly writing // them out is good even when redundant #![allow(clippy::needless_lifetimes)] diff --git a/utils/zerofrom/derive/src/lib.rs b/utils/zerofrom/derive/src/lib.rs index 67d40851e75..03abda31e59 100644 --- a/utils/zerofrom/derive/src/lib.rs +++ b/utils/zerofrom/derive/src/lib.rs @@ -5,18 +5,7 @@ //! Custom derives for `ZeroFrom` from the `zerofrom` crate. // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] + use core::mem; use proc_macro::TokenStream; diff --git a/utils/zerofrom/src/lib.rs b/utils/zerofrom/src/lib.rs index 88ce8f61465..5492cf2910d 100644 --- a/utils/zerofrom/src/lib.rs +++ b/utils/zerofrom/src/lib.rs @@ -8,18 +8,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(test), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] + // The lifetimes here are important for safety and explicitly writing // them out is good even when redundant #![allow(clippy::needless_lifetimes)] diff --git a/utils/zerotrie/src/lib.rs b/utils/zerotrie/src/lib.rs index 0f6e05f0814..f1f302a6a19 100644 --- a/utils/zerotrie/src/lib.rs +++ b/utils/zerotrie/src/lib.rs @@ -36,19 +36,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(test), no_std)] -#![cfg_attr( - not(test), - deny( - // TODO(#4034): Enable the rest of these lints. - // clippy::indexing_slicing, - // clippy::unwrap_used, - clippy::expect_used, - // clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] + #![warn(missing_docs)] #[cfg(feature = "alloc")] diff --git a/utils/zerovec/src/lib.rs b/utils/zerovec/src/lib.rs index 2d8c34fdf11..094dba240d4 100644 --- a/utils/zerovec/src/lib.rs +++ b/utils/zerovec/src/lib.rs @@ -195,18 +195,7 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic, - clippy::exhaustive_structs, - clippy::exhaustive_enums, - missing_debug_implementations, - ) -)] + // this crate does a lot of nuanced lifetime manipulation, being explicit // is better here. #![allow(clippy::needless_lifetimes)] From 75ea63bad3c55c743e98f401a6ea93d2ccd00e65 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 10 Jan 2025 11:17:36 -0800 Subject: [PATCH 3/7] Add global lint config --- Cargo.toml | 13 +++++++++++++ clippy.toml | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index ea22b4bba0b..1da84b2dde7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -325,3 +325,16 @@ lto = true [profile.bench-memory] inherits = "bench" debug = true + +[workspace.lints.rust] +missing_docs = "warn" +missing_debug_implementations = "deny" +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(icu4x_run_size_tests)', 'cfg(needs_alloc_error_handler)'] } + +[workspace.lints.clippy] +indexing_slicing = "deny" +unwrap_used = "deny" +expect_used = "deny" +panic = "deny" +exhaustive_structs = "deny" +exhaustive_enums = "deny" \ No newline at end of file diff --git a/clippy.toml b/clippy.toml index e90a772cb78..13f85c1ebf5 100644 --- a/clippy.toml +++ b/clippy.toml @@ -3,3 +3,10 @@ # (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). msrv = "1.81" + +allow-panic-in-tests = true +allow-expect-in-tests = true +allow-unwrap-in-tests = true + +# Not yet available in Clippy +# allow-indexing-slicing-in-tests = true \ No newline at end of file From 97b4153758e3baa48a73f2d10f078661b65f5196 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 10 Jan 2025 11:27:17 -0800 Subject: [PATCH 4/7] Fix some crates --- components/calendar/src/lib.rs | 1 - components/casemap/src/lib.rs | 1 - components/collator/src/lib.rs | 1 - components/collections/codepointtrie_builder/Cargo.toml | 3 --- components/collections/codepointtrie_builder/src/lib.rs | 2 -- components/collections/src/codepointinvlist/mod.rs | 1 - components/collections/src/lib.rs | 1 - components/datetime/Cargo.toml | 3 --- components/datetime/src/lib.rs | 1 - components/decimal/Cargo.toml | 3 --- components/decimal/src/lib.rs | 1 - components/experimental/src/compactdecimal/mod.rs | 1 - components/experimental/src/displaynames/mod.rs | 1 - components/experimental/src/duration/mod.rs | 1 - components/experimental/src/relativetime/mod.rs | 1 - components/experimental/src/transliterate/mod.rs | 1 - components/experimental/src/unicodeset_parse/mod.rs | 1 - components/icu/src/lib.rs | 1 - components/list/src/lib.rs | 1 - components/locale/src/lib.rs | 1 - components/locale_core/src/lib.rs | 1 - components/normalizer/src/lib.rs | 1 - components/pattern/src/lib.rs | 1 - components/plurals/src/lib.rs | 1 - components/properties/src/lib.rs | 1 - components/segmenter/src/lib.rs | 1 - components/timezone/src/lib.rs | 1 - provider/adapters/src/lib.rs | 1 - provider/blob/src/lib.rs | 1 - provider/core/macros/src/lib.rs | 1 - provider/core/src/lib.rs | 1 - provider/export/src/lib.rs | 2 -- provider/fs/src/lib.rs | 1 - utils/calendrical_calculations/src/lib.rs | 1 - utils/deduplicating_array/src/lib.rs | 1 - utils/fixed_decimal/src/lib.rs | 1 - utils/ixdtf/src/lib.rs | 1 - utils/litemap/src/lib.rs | 1 - utils/potential_utf/src/lib.rs | 1 - utils/resb/src/lib.rs | 1 - utils/tinystr/src/lib.rs | 1 - utils/writeable/src/lib.rs | 1 - utils/yoke/src/lib.rs | 1 - utils/zerofrom/derive/src/lib.rs | 1 - utils/zerofrom/src/lib.rs | 1 - utils/zerotrie/src/lib.rs | 1 - utils/zerovec/src/lib.rs | 1 - 47 files changed, 55 deletions(-) diff --git a/components/calendar/src/lib.rs b/components/calendar/src/lib.rs index 787d2063930..88cef2279cb 100644 --- a/components/calendar/src/lib.rs +++ b/components/calendar/src/lib.rs @@ -96,7 +96,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - extern crate alloc; // Make sure inherent docs go first diff --git a/components/casemap/src/lib.rs b/components/casemap/src/lib.rs index d3109a957f6..47f9e541f06 100644 --- a/components/casemap/src/lib.rs +++ b/components/casemap/src/lib.rs @@ -29,7 +29,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - // We're using Greek identifiers here on purpose. These lints can only be disabled at the crate level #![allow(confusable_idents, uncommon_codepoints)] diff --git a/components/collator/src/lib.rs b/components/collator/src/lib.rs index 2222e26cb83..17200c5c3e0 100644 --- a/components/collator/src/lib.rs +++ b/components/collator/src/lib.rs @@ -9,7 +9,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - //! Comparing strings according to language-dependent conventions. //! //! This module is published as its own crate ([`icu_collator`](https://docs.rs/icu_collator/latest/icu_collator/)) diff --git a/components/collections/codepointtrie_builder/Cargo.toml b/components/collections/codepointtrie_builder/Cargo.toml index 797ccdbd815..d3e22cf90c3 100644 --- a/components/collections/codepointtrie_builder/Cargo.toml +++ b/components/collections/codepointtrie_builder/Cargo.toml @@ -55,6 +55,3 @@ denylist = ["icu4c"] [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(icu4c_enable_renaming)'] } - -[lints] -workspace = true diff --git a/components/collections/codepointtrie_builder/src/lib.rs b/components/collections/codepointtrie_builder/src/lib.rs index b24f84bcc0b..467c3f2fd60 100644 --- a/components/collections/codepointtrie_builder/src/lib.rs +++ b/components/collections/codepointtrie_builder/src/lib.rs @@ -71,8 +71,6 @@ //! [`CodePointTrie`]: icu_collections::codepointtrie::CodePointTrie //! [`UMutableCPTrie`]: (https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/umutablecptrie_8h.html#ad8945cf34ca9d40596a66a1395baa19b) - - use icu_collections::codepointtrie::TrieType; use icu_collections::codepointtrie::TrieValue; diff --git a/components/collections/src/codepointinvlist/mod.rs b/components/collections/src/codepointinvlist/mod.rs index 8fdfc8eeed5..b03f7f62dd5 100644 --- a/components/collections/src/codepointinvlist/mod.rs +++ b/components/collections/src/codepointinvlist/mod.rs @@ -51,7 +51,6 @@ //! //! [`ICU4X`]: ../icu/index.html - extern crate alloc; #[macro_use] diff --git a/components/collections/src/lib.rs b/components/collections/src/lib.rs index eb68664ae60..305eaf26bad 100644 --- a/components/collections/src/lib.rs +++ b/components/collections/src/lib.rs @@ -23,7 +23,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - extern crate alloc; pub mod char16trie; diff --git a/components/datetime/Cargo.toml b/components/datetime/Cargo.toml index 44079546ac1..45f112dee20 100644 --- a/components/datetime/Cargo.toml +++ b/components/datetime/Cargo.toml @@ -108,9 +108,6 @@ skip_optional_dependencies = true # Bench feature gets tested separately and is only relevant for CI denylist = ["bench"] -[lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(icu4x_run_size_tests)'] } - [[bench]] name = "datetime" harness = false diff --git a/components/datetime/src/lib.rs b/components/datetime/src/lib.rs index f2e8aa9a40b..f91c4d7098a 100644 --- a/components/datetime/src/lib.rs +++ b/components/datetime/src/lib.rs @@ -72,7 +72,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - extern crate alloc; mod combo; diff --git a/components/decimal/Cargo.toml b/components/decimal/Cargo.toml index 5de0a0cd23b..d842716090b 100644 --- a/components/decimal/Cargo.toml +++ b/components/decimal/Cargo.toml @@ -56,9 +56,6 @@ compiled_data = ["dep:icu_decimal_data"] # Bench feature gets tested separately and is only relevant for CI denylist = ["bench"] -[lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(icu4x_run_size_tests)'] } - [[bench]] name = "fixed_decimal_format" harness = false diff --git a/components/decimal/src/lib.rs b/components/decimal/src/lib.rs index 274c9d4a207..2cc96da7c4b 100644 --- a/components/decimal/src/lib.rs +++ b/components/decimal/src/lib.rs @@ -78,7 +78,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - extern crate alloc; mod format; diff --git a/components/experimental/src/compactdecimal/mod.rs b/components/experimental/src/compactdecimal/mod.rs index 2c4dab388ff..f73ea900677 100644 --- a/components/experimental/src/compactdecimal/mod.rs +++ b/components/experimental/src/compactdecimal/mod.rs @@ -6,7 +6,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations - mod error; mod format; mod formatter; diff --git a/components/experimental/src/displaynames/mod.rs b/components/experimental/src/displaynames/mod.rs index 9f431cf0b1e..6cae7175d38 100644 --- a/components/experimental/src/displaynames/mod.rs +++ b/components/experimental/src/displaynames/mod.rs @@ -8,7 +8,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations - mod displaynames; mod options; pub mod provider; diff --git a/components/experimental/src/duration/mod.rs b/components/experimental/src/duration/mod.rs index 7ebfe2047c0..5dacd5c5738 100644 --- a/components/experimental/src/duration/mod.rs +++ b/components/experimental/src/duration/mod.rs @@ -4,7 +4,6 @@ //! Duration formatting - mod duration; mod format; mod formatter; diff --git a/components/experimental/src/relativetime/mod.rs b/components/experimental/src/relativetime/mod.rs index 6486d78f164..e51ee0f5244 100644 --- a/components/experimental/src/relativetime/mod.rs +++ b/components/experimental/src/relativetime/mod.rs @@ -4,7 +4,6 @@ //! Relative time formatting - mod format; pub mod options; pub mod provider; diff --git a/components/experimental/src/transliterate/mod.rs b/components/experimental/src/transliterate/mod.rs index 99ff5c51273..4d0c47a747a 100644 --- a/components/experimental/src/transliterate/mod.rs +++ b/components/experimental/src/transliterate/mod.rs @@ -8,7 +8,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations - pub mod provider; mod compile; diff --git a/components/experimental/src/unicodeset_parse/mod.rs b/components/experimental/src/unicodeset_parse/mod.rs index 71eb7a58b54..d22f4a18393 100644 --- a/components/experimental/src/unicodeset_parse/mod.rs +++ b/components/experimental/src/unicodeset_parse/mod.rs @@ -12,7 +12,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations - mod parse; pub use parse::*; diff --git a/components/icu/src/lib.rs b/components/icu/src/lib.rs index fca9763ef3e..a38b88eade2 100644 --- a/components/icu/src/lib.rs +++ b/components/icu/src/lib.rs @@ -129,7 +129,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - #[cfg(doc)] // Needed for intra-doc link to work, since icu_provider is otherwise never mentioned in this crate extern crate icu_provider; diff --git a/components/list/src/lib.rs b/components/list/src/lib.rs index b606168b825..159ef923b0e 100644 --- a/components/list/src/lib.rs +++ b/components/list/src/lib.rs @@ -74,7 +74,6 @@ #![cfg_attr(not(any(test, feature = "std")), no_std)] - extern crate alloc; mod lazy_automaton; diff --git a/components/locale/src/lib.rs b/components/locale/src/lib.rs index 7c6897e4aee..b0b0c5849e8 100644 --- a/components/locale/src/lib.rs +++ b/components/locale/src/lib.rs @@ -71,7 +71,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - extern crate alloc; mod canonicalizer; diff --git a/components/locale_core/src/lib.rs b/components/locale_core/src/lib.rs index ae66ee222a0..2aa0fb6cff7 100644 --- a/components/locale_core/src/lib.rs +++ b/components/locale_core/src/lib.rs @@ -51,7 +51,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - extern crate alloc; #[macro_use] diff --git a/components/normalizer/src/lib.rs b/components/normalizer/src/lib.rs index a736d1538d8..324cc92fd28 100644 --- a/components/normalizer/src/lib.rs +++ b/components/normalizer/src/lib.rs @@ -5,7 +5,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - //! Normalizing text into Unicode Normalization Forms. //! //! This module is published as its own crate ([`icu_normalizer`](https://docs.rs/icu_normalizer/latest/icu_normalizer/)) diff --git a/components/pattern/src/lib.rs b/components/pattern/src/lib.rs index 0fda0ecbfe2..55323e8288c 100644 --- a/components/pattern/src/lib.rs +++ b/components/pattern/src/lib.rs @@ -33,7 +33,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - #[cfg(feature = "alloc")] extern crate alloc; diff --git a/components/plurals/src/lib.rs b/components/plurals/src/lib.rs index ec1d62dde42..ee04c41a46b 100644 --- a/components/plurals/src/lib.rs +++ b/components/plurals/src/lib.rs @@ -60,7 +60,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - extern crate alloc; mod operands; diff --git a/components/properties/src/lib.rs b/components/properties/src/lib.rs index b0dad450b62..7c3dbe56ff2 100644 --- a/components/properties/src/lib.rs +++ b/components/properties/src/lib.rs @@ -54,7 +54,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - extern crate alloc; mod code_point_set; diff --git a/components/segmenter/src/lib.rs b/components/segmenter/src/lib.rs index 116a413c708..cf72d53b9e7 100644 --- a/components/segmenter/src/lib.rs +++ b/components/segmenter/src/lib.rs @@ -102,7 +102,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - extern crate alloc; mod complex; diff --git a/components/timezone/src/lib.rs b/components/timezone/src/lib.rs index 9c8666bab58..e98576e5121 100644 --- a/components/timezone/src/lib.rs +++ b/components/timezone/src/lib.rs @@ -85,7 +85,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - extern crate alloc; mod error; diff --git a/provider/adapters/src/lib.rs b/provider/adapters/src/lib.rs index 555ac807aaf..99f5c63af26 100644 --- a/provider/adapters/src/lib.rs +++ b/provider/adapters/src/lib.rs @@ -12,7 +12,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - extern crate alloc; pub mod either; diff --git a/provider/blob/src/lib.rs b/provider/blob/src/lib.rs index c4fb9df8bdc..27c692f4891 100644 --- a/provider/blob/src/lib.rs +++ b/provider/blob/src/lib.rs @@ -18,7 +18,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - extern crate alloc; mod blob_data_provider; diff --git a/provider/core/macros/src/lib.rs b/provider/core/macros/src/lib.rs index 3fa8e2ec537..c0051275130 100644 --- a/provider/core/macros/src/lib.rs +++ b/provider/core/macros/src/lib.rs @@ -4,7 +4,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations - //! Proc macros for the ICU4X data provider. //! //! These macros are re-exported from `icu_provider`. diff --git a/provider/core/src/lib.rs b/provider/core/src/lib.rs index d09612c47f1..e570459c7c6 100644 --- a/provider/core/src/lib.rs +++ b/provider/core/src/lib.rs @@ -93,7 +93,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - extern crate alloc; pub mod any; diff --git a/provider/export/src/lib.rs b/provider/export/src/lib.rs index 3aaad9e279f..c171f01c4f5 100644 --- a/provider/export/src/lib.rs +++ b/provider/export/src/lib.rs @@ -45,8 +45,6 @@ //! * `rayon` //! * enables parallelism during export - - mod export_impl; mod locale_family; use icu_provider::export::ExporterCloseMetadata; diff --git a/provider/fs/src/lib.rs b/provider/fs/src/lib.rs index 59e1f94eefb..b630a38dce9 100644 --- a/provider/fs/src/lib.rs +++ b/provider/fs/src/lib.rs @@ -78,7 +78,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations - mod fs_data_provider; mod manifest; diff --git a/utils/calendrical_calculations/src/lib.rs b/utils/calendrical_calculations/src/lib.rs index f1fb0857372..aa12078885a 100644 --- a/utils/calendrical_calculations/src/lib.rs +++ b/utils/calendrical_calculations/src/lib.rs @@ -20,7 +20,6 @@ //! to add more structure to this crate as needed. // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - #![warn(missing_docs)] mod astronomy; diff --git a/utils/deduplicating_array/src/lib.rs b/utils/deduplicating_array/src/lib.rs index 42a881ee222..614b70c6bca 100644 --- a/utils/deduplicating_array/src/lib.rs +++ b/utils/deduplicating_array/src/lib.rs @@ -31,7 +31,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(test), no_std)] - extern crate alloc; use alloc::fmt::{Error, Formatter}; diff --git a/utils/fixed_decimal/src/lib.rs b/utils/fixed_decimal/src/lib.rs index effb3b15bbc..07ed3599f75 100644 --- a/utils/fixed_decimal/src/lib.rs +++ b/utils/fixed_decimal/src/lib.rs @@ -39,7 +39,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - mod compact; mod decimal; mod integer; diff --git a/utils/ixdtf/src/lib.rs b/utils/ixdtf/src/lib.rs index 0a6eef3b61c..8b2d5093d7a 100644 --- a/utils/ixdtf/src/lib.rs +++ b/utils/ixdtf/src/lib.rs @@ -375,7 +375,6 @@ #![no_std] - mod error; pub mod parsers; diff --git a/utils/litemap/src/lib.rs b/utils/litemap/src/lib.rs index 0dd2bd7283f..af6e8a1ebc8 100644 --- a/utils/litemap/src/lib.rs +++ b/utils/litemap/src/lib.rs @@ -33,7 +33,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(test), no_std)] - // for intra doc links #[cfg(doc)] extern crate std; diff --git a/utils/potential_utf/src/lib.rs b/utils/potential_utf/src/lib.rs index f2b66ec5328..00d79d25d40 100644 --- a/utils/potential_utf/src/lib.rs +++ b/utils/potential_utf/src/lib.rs @@ -4,7 +4,6 @@ #![cfg_attr(not(test), no_std)] - //! A crate providing unvalidated string and character types. #[cfg(feature = "alloc")] diff --git a/utils/resb/src/lib.rs b/utils/resb/src/lib.rs index 2d6a71e1624..964d026925a 100644 --- a/utils/resb/src/lib.rs +++ b/utils/resb/src/lib.rs @@ -12,7 +12,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - #![warn(missing_docs)] pub mod binary; diff --git a/utils/tinystr/src/lib.rs b/utils/tinystr/src/lib.rs index 8993c20ef9c..d698fe5be02 100644 --- a/utils/tinystr/src/lib.rs +++ b/utils/tinystr/src/lib.rs @@ -54,7 +54,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - mod macros; mod ascii; diff --git a/utils/writeable/src/lib.rs b/utils/writeable/src/lib.rs index 04d283f3140..b61956b4462 100644 --- a/utils/writeable/src/lib.rs +++ b/utils/writeable/src/lib.rs @@ -5,7 +5,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(all(not(test), not(doc)), no_std)] - //! `writeable` is a utility crate of the [`ICU4X`] project. //! //! It includes [`Writeable`], a core trait representing an object that can be written to a diff --git a/utils/yoke/src/lib.rs b/utils/yoke/src/lib.rs index 03c217cf398..44e56330d12 100644 --- a/utils/yoke/src/lib.rs +++ b/utils/yoke/src/lib.rs @@ -26,7 +26,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(all(not(test), not(doc)), no_std)] - // The lifetimes here are important for safety and explicitly writing // them out is good even when redundant #![allow(clippy::needless_lifetimes)] diff --git a/utils/zerofrom/derive/src/lib.rs b/utils/zerofrom/derive/src/lib.rs index 03abda31e59..07160ec967d 100644 --- a/utils/zerofrom/derive/src/lib.rs +++ b/utils/zerofrom/derive/src/lib.rs @@ -6,7 +6,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations - use core::mem; use proc_macro::TokenStream; use proc_macro2::{Span, TokenStream as TokenStream2}; diff --git a/utils/zerofrom/src/lib.rs b/utils/zerofrom/src/lib.rs index 5492cf2910d..ce97ff79ad3 100644 --- a/utils/zerofrom/src/lib.rs +++ b/utils/zerofrom/src/lib.rs @@ -8,7 +8,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(test), no_std)] - // The lifetimes here are important for safety and explicitly writing // them out is good even when redundant #![allow(clippy::needless_lifetimes)] diff --git a/utils/zerotrie/src/lib.rs b/utils/zerotrie/src/lib.rs index f1f302a6a19..d2c0f634e24 100644 --- a/utils/zerotrie/src/lib.rs +++ b/utils/zerotrie/src/lib.rs @@ -36,7 +36,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(test), no_std)] - #![warn(missing_docs)] #[cfg(feature = "alloc")] diff --git a/utils/zerovec/src/lib.rs b/utils/zerovec/src/lib.rs index 094dba240d4..bc19297d21b 100644 --- a/utils/zerovec/src/lib.rs +++ b/utils/zerovec/src/lib.rs @@ -195,7 +195,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - // this crate does a lot of nuanced lifetime manipulation, being explicit // is better here. #![allow(clippy::needless_lifetimes)] From f4d0e97a20727b2c20df8aeea9165dda4767c253 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 10 Jan 2025 11:39:03 -0800 Subject: [PATCH 5/7] Allow some lints in some crates --- Cargo.toml | 2 +- components/collections/src/lib.rs | 3 +++ components/experimental/Cargo.toml | 6 +++--- provider/baked/Cargo.toml | 5 +++-- provider/core/macros/src/lib.rs | 4 ++++ provider/export/src/lib.rs | 3 +++ provider/icu4x-datagen/src/main.rs | 4 ++++ provider/source/src/lib.rs | 3 +++ utils/bies/Cargo.toml | 5 +++-- utils/crlify/Cargo.toml | 5 +++-- utils/databake/Cargo.toml | 5 +++-- utils/databake/derive/src/lib.rs | 3 +++ utils/deduplicating_array/examples/postcard.rs | 3 +++ utils/env_preferences/Cargo.toml | 5 +++-- utils/fixed_decimal/src/lib.rs | 3 +++ utils/ixdtf/src/lib.rs | 5 +++++ utils/tzif/Cargo.toml | 5 +++-- utils/writeable/examples/writeable_message.rs | 3 +++ utils/writeable/src/lib.rs | 3 +++ utils/yoke/derive/src/lib.rs | 3 +++ utils/yoke/tests/bincode.rs | 2 ++ utils/zerotrie/src/lib.rs | 4 +++- utils/zerovec/derive/src/lib.rs | 4 ++++ 23 files changed, 71 insertions(+), 17 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1da84b2dde7..4f345db0fc1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -327,7 +327,7 @@ inherits = "bench" debug = true [workspace.lints.rust] -missing_docs = "warn" +# missing_docs = "warn" missing_debug_implementations = "deny" unexpected_cfgs = { level = "warn", check-cfg = ['cfg(icu4x_run_size_tests)', 'cfg(needs_alloc_error_handler)'] } diff --git a/components/collections/src/lib.rs b/components/collections/src/lib.rs index 305eaf26bad..b0ee8a8f195 100644 --- a/components/collections/src/lib.rs +++ b/components/collections/src/lib.rs @@ -23,6 +23,9 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] +// TODO +#![allow(clippy::exhaustive_structs, clippy::exhaustive_enums, missing_debug_implementations)] + extern crate alloc; pub mod char16trie; diff --git a/components/experimental/Cargo.toml b/components/experimental/Cargo.toml index d4d62eae7d3..b763521f8f0 100644 --- a/components/experimental/Cargo.toml +++ b/components/experimental/Cargo.toml @@ -107,6 +107,6 @@ path = "tests/transliterate/lower_ascii.rs" name = "units_test" path = "tests/units/units_test.rs" - -[lints] -workspace = true +# No boilerplate, each module has their own +# [lints] +# workspace = true diff --git a/provider/baked/Cargo.toml b/provider/baked/Cargo.toml index ad46695263e..6d4316ee365 100644 --- a/provider/baked/Cargo.toml +++ b/provider/baked/Cargo.toml @@ -45,5 +45,6 @@ export = [ ] -[lints] -workspace = true +# TODO +# [lints] +# workspace = true diff --git a/provider/core/macros/src/lib.rs b/provider/core/macros/src/lib.rs index c0051275130..1a986f49f9c 100644 --- a/provider/core/macros/src/lib.rs +++ b/provider/core/macros/src/lib.rs @@ -8,6 +8,10 @@ //! //! These macros are re-exported from `icu_provider`. +// Proc macro +#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] + + extern crate proc_macro; use proc_macro::TokenStream; use proc_macro2::Span; diff --git a/provider/export/src/lib.rs b/provider/export/src/lib.rs index c171f01c4f5..ba5ba453c84 100644 --- a/provider/export/src/lib.rs +++ b/provider/export/src/lib.rs @@ -45,6 +45,9 @@ //! * `rayon` //! * enables parallelism during export +// Primarily used in datagen +#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] + mod export_impl; mod locale_family; use icu_provider::export::ExporterCloseMetadata; diff --git a/provider/icu4x-datagen/src/main.rs b/provider/icu4x-datagen/src/main.rs index c4074cfdc61..2efc643dc37 100644 --- a/provider/icu4x-datagen/src/main.rs +++ b/provider/icu4x-datagen/src/main.rs @@ -26,6 +26,10 @@ allow(unused_assignments, unreachable_code, unused_variables) )] +// Primarily used in datagen +#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] + + use clap::{Parser, ValueEnum}; use eyre::WrapErr; use icu_provider::export::ExportableProvider; diff --git a/provider/source/src/lib.rs b/provider/source/src/lib.rs index c06ab16bdc2..17cae92d0e0 100644 --- a/provider/source/src/lib.rs +++ b/provider/source/src/lib.rs @@ -17,6 +17,9 @@ //! * `experimental` //! * enables markers defined in the unstable `icu::experimental` module +// Primarily used in datagen +#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] + use cldr_cache::CldrCache; use elsa::sync::FrozenMap; use icu_provider::prelude::*; diff --git a/utils/bies/Cargo.toml b/utils/bies/Cargo.toml index 4b1a62b5016..952bb5ca3c5 100644 --- a/utils/bies/Cargo.toml +++ b/utils/bies/Cargo.toml @@ -33,5 +33,6 @@ rand_distr = { workspace = true } rand_pcg = { workspace = true } -[lints] -workspace = true +# TODO +# [lints] +# workspace = true diff --git a/utils/crlify/Cargo.toml b/utils/crlify/Cargo.toml index 7586b6db654..8180631e1bf 100644 --- a/utils/crlify/Cargo.toml +++ b/utils/crlify/Cargo.toml @@ -20,5 +20,6 @@ rust-version.workspace = true independent = true -[lints] -workspace = true +# TODO +# [lints] +# workspace = true diff --git a/utils/databake/Cargo.toml b/utils/databake/Cargo.toml index 5829e9981c5..62a09d514f8 100644 --- a/utils/databake/Cargo.toml +++ b/utils/databake/Cargo.toml @@ -31,5 +31,6 @@ quote = { workspace = true } databake-derive = { workspace = true, optional = true} -[lints] -workspace = true +# TODO +# [lints] +# workspace = true diff --git a/utils/databake/derive/src/lib.rs b/utils/databake/derive/src/lib.rs index 74a01339e0c..a958e4b3b07 100644 --- a/utils/databake/derive/src/lib.rs +++ b/utils/databake/derive/src/lib.rs @@ -4,6 +4,9 @@ //! Custom derives for `Bake` +// Proc macro +#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] + use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; use quote::quote; diff --git a/utils/deduplicating_array/examples/postcard.rs b/utils/deduplicating_array/examples/postcard.rs index af76f245466..c4a57257387 100644 --- a/utils/deduplicating_array/examples/postcard.rs +++ b/utils/deduplicating_array/examples/postcard.rs @@ -4,6 +4,9 @@ // This example demonstrates how to use deduplicating_array +// Example code +#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] + #[derive(serde::Serialize, serde::Deserialize)] struct DataStruct { #[serde(with = "deduplicating_array")] diff --git a/utils/env_preferences/Cargo.toml b/utils/env_preferences/Cargo.toml index caf57ff21ab..161dc155b7c 100644 --- a/utils/env_preferences/Cargo.toml +++ b/utils/env_preferences/Cargo.toml @@ -37,5 +37,6 @@ features = [ icu_locale = { path = "../../components/locale" } -[lints] -workspace = true +# TODO +# [lints] +# workspace = true diff --git a/utils/fixed_decimal/src/lib.rs b/utils/fixed_decimal/src/lib.rs index 07ed3599f75..7ae0d94d479 100644 --- a/utils/fixed_decimal/src/lib.rs +++ b/utils/fixed_decimal/src/lib.rs @@ -39,6 +39,9 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] +// TODO +#![allow(missing_docs)] + mod compact; mod decimal; mod integer; diff --git a/utils/ixdtf/src/lib.rs b/utils/ixdtf/src/lib.rs index 8b2d5093d7a..894fc8c50d6 100644 --- a/utils/ixdtf/src/lib.rs +++ b/utils/ixdtf/src/lib.rs @@ -375,6 +375,11 @@ #![no_std] +// TODO: until we can enable allow-indexing-slicing-in-tests +#![cfg_attr(test, allow(clippy::indexing_slicing))] + + + mod error; pub mod parsers; diff --git a/utils/tzif/Cargo.toml b/utils/tzif/Cargo.toml index b5db91021f5..e36d5da644a 100644 --- a/utils/tzif/Cargo.toml +++ b/utils/tzif/Cargo.toml @@ -25,5 +25,6 @@ combine = { workspace = true } walkdir = { workspace = true } -[lints] -workspace = true +# TODO +# [lints] +# workspace = true diff --git a/utils/writeable/examples/writeable_message.rs b/utils/writeable/examples/writeable_message.rs index ca7c773d7ee..579aa049823 100644 --- a/utils/writeable/examples/writeable_message.rs +++ b/utils/writeable/examples/writeable_message.rs @@ -4,6 +4,9 @@ // This example illustrates a very simple type implementing Writeable. +// Example code +#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] + #![no_main] // https://github.com/unicode-org/icu4x/issues/395 icu_benchmark_macros::instrument!(); diff --git a/utils/writeable/src/lib.rs b/utils/writeable/src/lib.rs index b61956b4462..db9c2b1b794 100644 --- a/utils/writeable/src/lib.rs +++ b/utils/writeable/src/lib.rs @@ -5,6 +5,9 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(all(not(test), not(doc)), no_std)] +// TODO: until we can enable allow-indexing-slicing-in-tests +#![cfg_attr(test, allow(clippy::indexing_slicing))] + //! `writeable` is a utility crate of the [`ICU4X`] project. //! //! It includes [`Writeable`], a core trait representing an object that can be written to a diff --git a/utils/yoke/derive/src/lib.rs b/utils/yoke/derive/src/lib.rs index 4d3d8843a4f..a0a05a575fb 100644 --- a/utils/yoke/derive/src/lib.rs +++ b/utils/yoke/derive/src/lib.rs @@ -4,6 +4,9 @@ //! Custom derives for `Yokeable` from the `yoke` crate. +// Proc macro +#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] + use proc_macro::TokenStream; use proc_macro2::{Span, TokenStream as TokenStream2}; use quote::quote; diff --git a/utils/yoke/tests/bincode.rs b/utils/yoke/tests/bincode.rs index 653865e75f6..5a4c3d6821d 100644 --- a/utils/yoke/tests/bincode.rs +++ b/utils/yoke/tests/bincode.rs @@ -5,6 +5,8 @@ // This test is a duplicate of one of the doctests, but is written separately // since `cargo miri test` doesn't work on doctests yet +#![allow(clippy::unwrap_used)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use std::borrow::Cow; use std::mem; use std::rc::Rc; diff --git a/utils/zerotrie/src/lib.rs b/utils/zerotrie/src/lib.rs index d2c0f634e24..207c778f88d 100644 --- a/utils/zerotrie/src/lib.rs +++ b/utils/zerotrie/src/lib.rs @@ -36,7 +36,9 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(test), no_std)] -#![warn(missing_docs)] + +// TODO(#4034): Enable the rest of these lints. +#![allow(clippy::indexing_slicing, clippy::unwrap_used, clippy::panic)] #[cfg(feature = "alloc")] extern crate alloc; diff --git a/utils/zerovec/derive/src/lib.rs b/utils/zerovec/derive/src/lib.rs index 9c3007147ae..70a4e43da5b 100644 --- a/utils/zerovec/derive/src/lib.rs +++ b/utils/zerovec/derive/src/lib.rs @@ -4,6 +4,10 @@ //! Proc macros for generating `ULE`, `VarULE` impls and types for the `zerovec` crate +// Proc macro +#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] + + use proc_macro::TokenStream; use syn::{parse_macro_input, DeriveInput, Ident}; mod make_ule; From c1a52bb95e0c1b2d770546be13913010eb5d627b Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 10 Jan 2025 11:49:06 -0800 Subject: [PATCH 6/7] code fixes --- utils/databake/derive/tests/derive.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/databake/derive/tests/derive.rs b/utils/databake/derive/tests/derive.rs index fb9be2bdac0..389cfbe755b 100644 --- a/utils/databake/derive/tests/derive.rs +++ b/utils/databake/derive/tests/derive.rs @@ -6,7 +6,7 @@ extern crate alloc; use databake::*; -#[derive(Bake)] +#[derive(Bake, Debug)] #[databake(path = test)] pub struct IntExample { x: u8, @@ -17,7 +17,7 @@ fn test_int_example() { test_bake!(IntExample, const, crate::IntExample { x: 17u8 }, test,); } -#[derive(Bake)] +#[derive(Bake, Debug)] #[databake(path = test)] pub struct GenericsExample { x: u32, @@ -37,7 +37,7 @@ fn test_generics_example() { ); } -#[derive(Bake)] +#[derive(Bake, Debug)] #[databake(path = test)] pub struct CowExample<'a> { x: u8, From 025fa10ecd694ce036d6c6a5293ecab78985e801 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 10 Jan 2025 12:16:20 -0800 Subject: [PATCH 7/7] more test allows --- components/calendar/benches/date.rs | 2 ++ components/calendar/benches/datetime.rs | 2 ++ components/calendar/src/lib.rs | 3 +++ components/collator/tests/tests.rs | 2 ++ components/collections/src/lib.rs | 7 ++++-- components/datetime/src/lib.rs | 3 +++ components/locale_core/benches/langid.rs | 2 ++ components/normalizer/tests/tests.rs | 2 ++ components/plurals/tests/fixtures/mod.rs | 2 ++ provider/blob/benches/auxkey_bench.rs | 5 +++- provider/blob/benches/blob_version_bench.rs | 2 ++ provider/blob/tests/test_versions.rs | 2 ++ provider/core/macros/src/lib.rs | 8 ++++-- provider/export/src/lib.rs | 7 +++++- provider/export/tests/test-options.rs | 2 ++ provider/export/tests/testutil.rs | 3 +++ provider/fs/benches/provider_fs.rs | 7 ++++++ provider/icu4x-datagen/src/main.rs | 9 ++++--- provider/source/src/lib.rs | 7 +++++- utils/databake/derive/src/lib.rs | 7 +++++- .../deduplicating_array/examples/postcard.rs | 7 +++++- utils/fixed_decimal/benches/fixed_decimal.rs | 2 ++ utils/fixed_decimal/src/lib.rs | 1 - utils/ixdtf/src/lib.rs | 3 --- utils/litemap/benches/litemap.rs | 2 ++ utils/litemap/examples/litemap_bincode.rs | 1 + utils/litemap/examples/litemap_postcard.rs | 1 + utils/litemap/src/lib.rs | 2 ++ utils/litemap/tests/rkyv.rs | 2 ++ utils/resb/examples/genrb.rs | 2 ++ utils/resb/examples/time_zone_rule.rs | 25 +++++++++++-------- utils/tinystr/benches/overview.rs | 7 ++++++ utils/tinystr/src/lib.rs | 2 ++ utils/writeable/benches/writeable.rs | 2 ++ utils/writeable/examples/writeable_message.rs | 8 ++++-- utils/writeable/src/lib.rs | 1 - utils/yoke/derive/examples/yoke_derive.rs | 2 +- utils/yoke/derive/src/lib.rs | 7 +++++- utils/zerofrom/derive/examples/zf_derive.rs | 7 +++++- utils/zerotrie/benches/overview.rs | 7 ++++++ utils/zerotrie/src/lib.rs | 1 - utils/zerotrie/tests/builder_test.rs | 7 ++++++ utils/zerovec/benches/vzv.rs | 2 ++ utils/zerovec/benches/zeromap.rs | 7 ++++++ utils/zerovec/benches/zerovec.rs | 7 ++++++ utils/zerovec/benches/zerovec_iai.rs | 2 ++ utils/zerovec/benches/zerovec_serde.rs | 7 ++++++ utils/zerovec/derive/examples/derives.rs | 8 ++++++ utils/zerovec/derive/examples/make.rs | 7 ++++++ utils/zerovec/derive/examples/make_var.rs | 7 ++++++ utils/zerovec/derive/src/lib.rs | 8 ++++-- utils/zerovec/examples/zv_serde.rs | 1 + utils/zerovec/src/lib.rs | 2 ++ 53 files changed, 205 insertions(+), 36 deletions(-) diff --git a/components/calendar/benches/date.rs b/components/calendar/benches/date.rs index 20376c7230f..fb2441549a0 100644 --- a/components/calendar/benches/date.rs +++ b/components/calendar/benches/date.rs @@ -2,6 +2,8 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing)] // https://github.com/rust-lang/rust-clippy/issues/13981 + mod fixtures; use criterion::{ diff --git a/components/calendar/benches/datetime.rs b/components/calendar/benches/datetime.rs index 21fb09a25ab..15c7fe30db8 100644 --- a/components/calendar/benches/datetime.rs +++ b/components/calendar/benches/datetime.rs @@ -2,6 +2,8 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing)] // https://github.com/rust-lang/rust-clippy/issues/13981 + mod fixtures; use criterion::{ diff --git a/components/calendar/src/lib.rs b/components/calendar/src/lib.rs index 88cef2279cb..78e9fc81e42 100644 --- a/components/calendar/src/lib.rs +++ b/components/calendar/src/lib.rs @@ -96,6 +96,9 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] +// TODO: until we can enable allow-indexing-slicing-in-tests +#![cfg_attr(test, allow(clippy::indexing_slicing))] + extern crate alloc; // Make sure inherent docs go first diff --git a/components/collator/tests/tests.rs b/components/collator/tests/tests.rs index f8586852558..30317c26f31 100644 --- a/components/collator/tests/tests.rs +++ b/components/collator/tests/tests.rs @@ -2,6 +2,8 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use core::cmp::Ordering; use atoi::FromRadix16; diff --git a/components/collections/src/lib.rs b/components/collections/src/lib.rs index b0ee8a8f195..c9c2bebeb0d 100644 --- a/components/collections/src/lib.rs +++ b/components/collections/src/lib.rs @@ -22,9 +22,12 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - // TODO -#![allow(clippy::exhaustive_structs, clippy::exhaustive_enums, missing_debug_implementations)] +#![allow( + clippy::exhaustive_structs, + clippy::exhaustive_enums, + missing_debug_implementations +)] extern crate alloc; diff --git a/components/datetime/src/lib.rs b/components/datetime/src/lib.rs index f91c4d7098a..5d2a51e93bc 100644 --- a/components/datetime/src/lib.rs +++ b/components/datetime/src/lib.rs @@ -72,6 +72,9 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] +// TODO: until we can enable allow-indexing-slicing-in-tests +#![cfg_attr(test, allow(clippy::indexing_slicing))] + extern crate alloc; mod combo; diff --git a/components/locale_core/benches/langid.rs b/components/locale_core/benches/langid.rs index 07754f267ad..7b6090762c7 100644 --- a/components/locale_core/benches/langid.rs +++ b/components/locale_core/benches/langid.rs @@ -2,6 +2,8 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing)] // https://github.com/rust-lang/rust-clippy/issues/13981 + mod fixtures; mod helpers; diff --git a/components/normalizer/tests/tests.rs b/components/normalizer/tests/tests.rs index 5e6d8770ce4..1c9d33473ee 100644 --- a/components/normalizer/tests/tests.rs +++ b/components/normalizer/tests/tests.rs @@ -2,6 +2,8 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use icu_normalizer::properties::CanonicalCombiningClassMap; use icu_normalizer::properties::CanonicalCombiningClassMapBorrowed; use icu_normalizer::properties::CanonicalComposition; diff --git a/components/plurals/tests/fixtures/mod.rs b/components/plurals/tests/fixtures/mod.rs index 6b198db8e79..2369cebee1a 100644 --- a/components/plurals/tests/fixtures/mod.rs +++ b/components/plurals/tests/fixtures/mod.rs @@ -2,6 +2,8 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use fixed_decimal::SignedFixedDecimal; #[cfg(feature = "experimental")] use icu_plurals::PluralOperands; diff --git a/provider/blob/benches/auxkey_bench.rs b/provider/blob/benches/auxkey_bench.rs index 8f23b783b2c..566501a6acb 100644 --- a/provider/blob/benches/auxkey_bench.rs +++ b/provider/blob/benches/auxkey_bench.rs @@ -2,6 +2,9 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing)] // https://github.com/rust-lang/rust-clippy/issues/13981 +#![allow(clippy::exhaustive_structs)] + use criterion::{black_box, criterion_group, criterion_main, Criterion}; use icu_locale::LocaleFallbacker; use icu_locale_core::{langid, LanguageIdentifier}; @@ -19,7 +22,7 @@ use std::collections::BTreeSet; marker(MarkerC, "c@1"), marker(MarkerD, "d@1") )] -#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, databake::Bake, PartialEq)] +#[derive(serde::Serialize, serde::Deserialize, Clone, Copy, databake::Bake, PartialEq, Debug)] #[databake(path = crate)] pub struct Empty; diff --git a/provider/blob/benches/blob_version_bench.rs b/provider/blob/benches/blob_version_bench.rs index 229b4a85e95..658b08a2a42 100644 --- a/provider/blob/benches/blob_version_bench.rs +++ b/provider/blob/benches/blob_version_bench.rs @@ -2,6 +2,8 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing)] // https://github.com/rust-lang/rust-clippy/issues/13981 + extern crate alloc; use criterion::{black_box, criterion_group, criterion_main, Criterion}; diff --git a/provider/blob/tests/test_versions.rs b/provider/blob/tests/test_versions.rs index 3033802d626..f5644afe913 100644 --- a/provider/blob/tests/test_versions.rs +++ b/provider/blob/tests/test_versions.rs @@ -2,6 +2,8 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use icu_locale::subtags::{region, script, Language}; use icu_locale_core::LanguageIdentifier; use icu_provider::dynutil::UpcastDataPayload; diff --git a/provider/core/macros/src/lib.rs b/provider/core/macros/src/lib.rs index 1a986f49f9c..5c21285be3e 100644 --- a/provider/core/macros/src/lib.rs +++ b/provider/core/macros/src/lib.rs @@ -9,8 +9,12 @@ //! These macros are re-exported from `icu_provider`. // Proc macro -#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] - +#![allow( + clippy::indexing_slicing, + clippy::panic, + clippy::unwrap_used, + clippy::expect_used +)] extern crate proc_macro; use proc_macro::TokenStream; diff --git a/provider/export/src/lib.rs b/provider/export/src/lib.rs index ba5ba453c84..d1f9850944f 100644 --- a/provider/export/src/lib.rs +++ b/provider/export/src/lib.rs @@ -46,7 +46,12 @@ //! * enables parallelism during export // Primarily used in datagen -#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] +#![allow( + clippy::indexing_slicing, + clippy::panic, + clippy::unwrap_used, + clippy::expect_used +)] mod export_impl; mod locale_family; diff --git a/provider/export/tests/test-options.rs b/provider/export/tests/test-options.rs index 782b0453eb6..ee9b249e3f7 100644 --- a/provider/export/tests/test-options.rs +++ b/provider/export/tests/test-options.rs @@ -2,6 +2,8 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing)] // https://github.com/rust-lang/rust-clippy/issues/13981 + #[path = "testutil.rs"] mod testutil; diff --git a/provider/export/tests/testutil.rs b/provider/export/tests/testutil.rs index 8033640025e..a1c46bdb8eb 100644 --- a/provider/export/tests/testutil.rs +++ b/provider/export/tests/testutil.rs @@ -2,6 +2,9 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing)] // https://github.com/rust-lang/rust-clippy/issues/13981 +#![allow(missing_debug_implementations)] + use std::collections::BTreeMap; use elsa::sync::FrozenMap; diff --git a/provider/fs/benches/provider_fs.rs b/provider/fs/benches/provider_fs.rs index 18cd7ff0367..131b9dbd18f 100644 --- a/provider/fs/benches/provider_fs.rs +++ b/provider/fs/benches/provider_fs.rs @@ -2,6 +2,13 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow( + clippy::unwrap_used, + clippy::expect_used, + clippy::panic, + clippy::indexing_slicing +)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use criterion::{black_box, criterion_group, criterion_main, Criterion}; use icu_locale_core::langid; diff --git a/provider/icu4x-datagen/src/main.rs b/provider/icu4x-datagen/src/main.rs index 2efc643dc37..cfcd5a96e6e 100644 --- a/provider/icu4x-datagen/src/main.rs +++ b/provider/icu4x-datagen/src/main.rs @@ -25,10 +25,13 @@ not(any(feature = "provider", feature = "blob_input",)), allow(unused_assignments, unreachable_code, unused_variables) )] - // Primarily used in datagen -#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] - +#![allow( + clippy::indexing_slicing, + clippy::panic, + clippy::unwrap_used, + clippy::expect_used +)] use clap::{Parser, ValueEnum}; use eyre::WrapErr; diff --git a/provider/source/src/lib.rs b/provider/source/src/lib.rs index 17cae92d0e0..abc420d2035 100644 --- a/provider/source/src/lib.rs +++ b/provider/source/src/lib.rs @@ -18,7 +18,12 @@ //! * enables markers defined in the unstable `icu::experimental` module // Primarily used in datagen -#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] +#![allow( + clippy::indexing_slicing, + clippy::panic, + clippy::unwrap_used, + clippy::expect_used +)] use cldr_cache::CldrCache; use elsa::sync::FrozenMap; diff --git a/utils/databake/derive/src/lib.rs b/utils/databake/derive/src/lib.rs index a958e4b3b07..6ce8963d694 100644 --- a/utils/databake/derive/src/lib.rs +++ b/utils/databake/derive/src/lib.rs @@ -5,7 +5,12 @@ //! Custom derives for `Bake` // Proc macro -#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] +#![allow( + clippy::indexing_slicing, + clippy::panic, + clippy::unwrap_used, + clippy::expect_used +)] use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; diff --git a/utils/deduplicating_array/examples/postcard.rs b/utils/deduplicating_array/examples/postcard.rs index c4a57257387..cfebace8fe2 100644 --- a/utils/deduplicating_array/examples/postcard.rs +++ b/utils/deduplicating_array/examples/postcard.rs @@ -5,7 +5,12 @@ // This example demonstrates how to use deduplicating_array // Example code -#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] +#![allow( + clippy::indexing_slicing, + clippy::panic, + clippy::unwrap_used, + clippy::expect_used +)] #[derive(serde::Serialize, serde::Deserialize)] struct DataStruct { diff --git a/utils/fixed_decimal/benches/fixed_decimal.rs b/utils/fixed_decimal/benches/fixed_decimal.rs index 1bc9f4bab64..79a0cc760c9 100644 --- a/utils/fixed_decimal/benches/fixed_decimal.rs +++ b/utils/fixed_decimal/benches/fixed_decimal.rs @@ -2,6 +2,8 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use core::str::FromStr; use rand::SeedableRng; use rand_distr::{Distribution, Triangular}; diff --git a/utils/fixed_decimal/src/lib.rs b/utils/fixed_decimal/src/lib.rs index 7ae0d94d479..74f23390930 100644 --- a/utils/fixed_decimal/src/lib.rs +++ b/utils/fixed_decimal/src/lib.rs @@ -38,7 +38,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] - // TODO #![allow(missing_docs)] diff --git a/utils/ixdtf/src/lib.rs b/utils/ixdtf/src/lib.rs index 894fc8c50d6..309df0190dc 100644 --- a/utils/ixdtf/src/lib.rs +++ b/utils/ixdtf/src/lib.rs @@ -374,12 +374,9 @@ //! [temporal-grammar]: https://tc39.es/proposal-temporal/#sec-temporal-iso8601grammar #![no_std] - // TODO: until we can enable allow-indexing-slicing-in-tests #![cfg_attr(test, allow(clippy::indexing_slicing))] - - mod error; pub mod parsers; diff --git a/utils/litemap/benches/litemap.rs b/utils/litemap/benches/litemap.rs index ffbf3646393..9d3eeec9c87 100644 --- a/utils/litemap/benches/litemap.rs +++ b/utils/litemap/benches/litemap.rs @@ -2,6 +2,8 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use criterion::{black_box, criterion_group, criterion_main, Criterion}; use litemap::LiteMap; diff --git a/utils/litemap/examples/litemap_bincode.rs b/utils/litemap/examples/litemap_bincode.rs index 3e27e2b6605..d320151924f 100644 --- a/utils/litemap/examples/litemap_bincode.rs +++ b/utils/litemap/examples/litemap_bincode.rs @@ -5,6 +5,7 @@ // LiteMap is intended as a small and low-memory drop-in replacement for // HashMap. This example demonstrates how it works with Serde. +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing)] // https://github.com/rust-lang/rust-clippy/issues/13981 #![no_main] // https://github.com/unicode-org/icu4x/issues/395 icu_benchmark_macros::instrument!(); diff --git a/utils/litemap/examples/litemap_postcard.rs b/utils/litemap/examples/litemap_postcard.rs index 7c1f0147493..7bb27d916ce 100644 --- a/utils/litemap/examples/litemap_postcard.rs +++ b/utils/litemap/examples/litemap_postcard.rs @@ -5,6 +5,7 @@ // LiteMap is intended as a small and low-memory drop-in replacement for // HashMap. This example demonstrates how it works with Serde. +#![allow(clippy::unwrap_used, clippy::expect_used)] // https://github.com/rust-lang/rust-clippy/issues/13981 #![no_main] // https://github.com/unicode-org/icu4x/issues/395 icu_benchmark_macros::instrument!(); diff --git a/utils/litemap/src/lib.rs b/utils/litemap/src/lib.rs index af6e8a1ebc8..3f28017ff6f 100644 --- a/utils/litemap/src/lib.rs +++ b/utils/litemap/src/lib.rs @@ -32,6 +32,8 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(test), no_std)] +// TODO: until we can enable allow-indexing-slicing-in-tests +#![cfg_attr(test, allow(clippy::indexing_slicing))] // for intra doc links #[cfg(doc)] diff --git a/utils/litemap/tests/rkyv.rs b/utils/litemap/tests/rkyv.rs index 7ab1eb3f5f0..cc75350182f 100644 --- a/utils/litemap/tests/rkyv.rs +++ b/utils/litemap/tests/rkyv.rs @@ -2,6 +2,8 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use litemap::LiteMap; use rkyv::archived_root; use rkyv::check_archived_root; diff --git a/utils/resb/examples/genrb.rs b/utils/resb/examples/genrb.rs index 004f77fd2cf..e2686c017b4 100644 --- a/utils/resb/examples/genrb.rs +++ b/utils/resb/examples/genrb.rs @@ -2,6 +2,8 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use std::{ fs::File, io::{BufReader, BufWriter, Read, Write}, diff --git a/utils/resb/examples/time_zone_rule.rs b/utils/resb/examples/time_zone_rule.rs index 95a5d8646fd..b5ac3b9e838 100644 --- a/utils/resb/examples/time_zone_rule.rs +++ b/utils/resb/examples/time_zone_rule.rs @@ -2,6 +2,9 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used)] // https://github.com/rust-lang/rust-clippy/issues/13981 +#![allow(unused)] // serialization test, we don't actually do anything with the data + use std::{char::DecodeUtf16Error, collections::HashMap, fmt::Debug, marker::PhantomData}; use serde::{ @@ -18,14 +21,14 @@ use zerovec::ZeroVec; /// terminator is included. #[derive(Deserialize, Serialize)] #[serde(transparent)] -pub struct ZeroUTF16String<'a> { +struct ZeroUTF16String<'a> { #[serde(borrow)] units: ZeroVec<'a, u16>, } impl ZeroUTF16String<'_> { /// Gets whether the UTF-16 string is empty. - pub fn is_empty(&self) -> bool { + fn is_empty(&self) -> bool { self.units.is_empty() } @@ -34,14 +37,14 @@ impl ZeroUTF16String<'_> { /// This value does not necessarily equal the length of the string in /// characters, as characters outside the Basic Multilingual Plane are /// represented by 2 units. - pub fn len(&self) -> usize { + fn len(&self) -> usize { self.units.len() } /// Gets an iterator for the units of the string. /// /// See `len` for details on why this does not correspond to characters. - pub fn iter(&self) -> impl Iterator + '_ { + fn iter(&self) -> impl Iterator + '_ { self.units.iter() } } @@ -65,7 +68,7 @@ impl Debug for ZeroUTF16String<'_> { #[derive(Debug, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] -pub struct TzDataRuleData<'a> { +struct TzDataRuleData<'a> { #[serde(borrow)] type_offsets: ZeroVec<'a, i32>, #[serde(borrow)] @@ -84,7 +87,7 @@ pub struct TzDataRuleData<'a> { } #[derive(Debug)] -pub enum TzDataRule<'a> { +enum TzDataRule<'a> { // The rule data is boxed here due to the large size difference between the // `TzDataRuleData` struct and `u32`. It's not strictly necessary. Table(Box>), @@ -133,15 +136,15 @@ impl<'de: 'a, 'a> Visitor<'de> for TzDataRuleEnumVisitor<'a> { #[derive(Debug, Deserialize)] #[serde(rename = "zoneinfo64")] #[serde(rename_all = "PascalCase")] -pub struct ZoneInfo64<'a> { +struct ZoneInfo64<'a> { #[serde(borrow)] - pub zones: Vec>, + zones: Vec>, #[serde(borrow)] - pub names: Vec>, + names: Vec>, #[serde(borrow)] - pub rules: HashMap<&'a str, ZeroVec<'a, i32>>, + rules: HashMap<&'a str, ZeroVec<'a, i32>>, #[serde(borrow)] - pub regions: Vec>, + regions: Vec>, } fn main() { diff --git a/utils/tinystr/benches/overview.rs b/utils/tinystr/benches/overview.rs index 474ff4b9f22..9d0a32834fe 100644 --- a/utils/tinystr/benches/overview.rs +++ b/utils/tinystr/benches/overview.rs @@ -2,6 +2,13 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow( + clippy::unwrap_used, + clippy::expect_used, + clippy::panic, + clippy::indexing_slicing +)] // https://github.com/rust-lang/rust-clippy/issues/13981 + mod common; use common::*; diff --git a/utils/tinystr/src/lib.rs b/utils/tinystr/src/lib.rs index d698fe5be02..f60f10de36b 100644 --- a/utils/tinystr/src/lib.rs +++ b/utils/tinystr/src/lib.rs @@ -53,6 +53,8 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(any(test, feature = "std")), no_std)] +// TODO: until we can enable allow-indexing-slicing-in-tests +#![cfg_attr(test, allow(clippy::indexing_slicing))] mod macros; diff --git a/utils/writeable/benches/writeable.rs b/utils/writeable/benches/writeable.rs index 6410bfd80f0..5e74f070c00 100644 --- a/utils/writeable/benches/writeable.rs +++ b/utils/writeable/benches/writeable.rs @@ -2,6 +2,8 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use criterion::{black_box, criterion_group, criterion_main, Criterion}; use std::fmt; use writeable::LengthHint; diff --git a/utils/writeable/examples/writeable_message.rs b/utils/writeable/examples/writeable_message.rs index 579aa049823..d3bffd2d939 100644 --- a/utils/writeable/examples/writeable_message.rs +++ b/utils/writeable/examples/writeable_message.rs @@ -5,8 +5,12 @@ // This example illustrates a very simple type implementing Writeable. // Example code -#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] - +#![allow( + clippy::indexing_slicing, + clippy::panic, + clippy::unwrap_used, + clippy::expect_used +)] #![no_main] // https://github.com/unicode-org/icu4x/issues/395 icu_benchmark_macros::instrument!(); diff --git a/utils/writeable/src/lib.rs b/utils/writeable/src/lib.rs index db9c2b1b794..ffdbc6e2bd5 100644 --- a/utils/writeable/src/lib.rs +++ b/utils/writeable/src/lib.rs @@ -4,7 +4,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(all(not(test), not(doc)), no_std)] - // TODO: until we can enable allow-indexing-slicing-in-tests #![cfg_attr(test, allow(clippy::indexing_slicing))] diff --git a/utils/yoke/derive/examples/yoke_derive.rs b/utils/yoke/derive/examples/yoke_derive.rs index d65ada1bc92..f2423d41f8e 100644 --- a/utils/yoke/derive/examples/yoke_derive.rs +++ b/utils/yoke/derive/examples/yoke_derive.rs @@ -2,7 +2,7 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -#![allow(unused)] +#![allow(unused, missing_debug_implementations)] use std::{borrow::Cow, marker::PhantomData}; use yoke::{Yoke, Yokeable}; diff --git a/utils/yoke/derive/src/lib.rs b/utils/yoke/derive/src/lib.rs index a0a05a575fb..1a74e77e61e 100644 --- a/utils/yoke/derive/src/lib.rs +++ b/utils/yoke/derive/src/lib.rs @@ -5,7 +5,12 @@ //! Custom derives for `Yokeable` from the `yoke` crate. // Proc macro -#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] +#![allow( + clippy::indexing_slicing, + clippy::panic, + clippy::unwrap_used, + clippy::expect_used +)] use proc_macro::TokenStream; use proc_macro2::{Span, TokenStream as TokenStream2}; diff --git a/utils/zerofrom/derive/examples/zf_derive.rs b/utils/zerofrom/derive/examples/zf_derive.rs index d3eb2a6fb65..09d953a78f8 100644 --- a/utils/zerofrom/derive/examples/zf_derive.rs +++ b/utils/zerofrom/derive/examples/zf_derive.rs @@ -2,7 +2,12 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). -#![allow(unused)] +#![allow( + unused, + missing_debug_implementations, + clippy::exhaustive_structs, + clippy::exhaustive_enums +)] use std::{borrow::Cow, marker::PhantomData}; use zerofrom::ZeroFrom; diff --git a/utils/zerotrie/benches/overview.rs b/utils/zerotrie/benches/overview.rs index 7c47d509780..0b19d3f37ce 100644 --- a/utils/zerotrie/benches/overview.rs +++ b/utils/zerotrie/benches/overview.rs @@ -2,6 +2,13 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow( + clippy::unwrap_used, + clippy::expect_used, + clippy::panic, + clippy::indexing_slicing +)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use criterion::{black_box, criterion_group, criterion_main, Criterion}; use litemap::LiteMap; #[cfg(feature = "bench")] diff --git a/utils/zerotrie/src/lib.rs b/utils/zerotrie/src/lib.rs index 207c778f88d..65f9cce400e 100644 --- a/utils/zerotrie/src/lib.rs +++ b/utils/zerotrie/src/lib.rs @@ -36,7 +36,6 @@ // https://github.com/unicode-org/icu4x/blob/main/documents/process/boilerplate.md#library-annotations #![cfg_attr(not(test), no_std)] - // TODO(#4034): Enable the rest of these lints. #![allow(clippy::indexing_slicing, clippy::unwrap_used, clippy::panic)] diff --git a/utils/zerotrie/tests/builder_test.rs b/utils/zerotrie/tests/builder_test.rs index 263169e080f..530d0b4cec9 100644 --- a/utils/zerotrie/tests/builder_test.rs +++ b/utils/zerotrie/tests/builder_test.rs @@ -2,6 +2,13 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow( + clippy::unwrap_used, + clippy::expect_used, + clippy::panic, + clippy::indexing_slicing +)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use litemap::LiteMap; use zerotrie::ZeroTriePerfectHash; use zerotrie::ZeroTrieSimpleAscii; diff --git a/utils/zerovec/benches/vzv.rs b/utils/zerovec/benches/vzv.rs index 2c689c74967..1fb75cf0d6b 100644 --- a/utils/zerovec/benches/vzv.rs +++ b/utils/zerovec/benches/vzv.rs @@ -2,6 +2,8 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use criterion::{black_box, criterion_group, criterion_main, Criterion}; use rand::SeedableRng; use rand_distr::{Alphanumeric, Distribution, Uniform}; diff --git a/utils/zerovec/benches/zeromap.rs b/utils/zerovec/benches/zeromap.rs index 24bfd92aa4c..106768864b8 100644 --- a/utils/zerovec/benches/zeromap.rs +++ b/utils/zerovec/benches/zeromap.rs @@ -2,6 +2,13 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow( + clippy::unwrap_used, + clippy::expect_used, + clippy::panic, + clippy::indexing_slicing +)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use std::collections::HashMap; use criterion::{black_box, criterion_group, criterion_main, Criterion}; diff --git a/utils/zerovec/benches/zerovec.rs b/utils/zerovec/benches/zerovec.rs index 933abf57df1..4bfd68b7289 100644 --- a/utils/zerovec/benches/zerovec.rs +++ b/utils/zerovec/benches/zerovec.rs @@ -2,6 +2,13 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow( + clippy::unwrap_used, + clippy::expect_used, + clippy::panic, + clippy::indexing_slicing +)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use criterion::{black_box, criterion_group, criterion_main, Criterion}; use rand::SeedableRng; use rand_distr::{Distribution, LogNormal}; diff --git a/utils/zerovec/benches/zerovec_iai.rs b/utils/zerovec/benches/zerovec_iai.rs index 85e2776c239..badc5789c17 100644 --- a/utils/zerovec/benches/zerovec_iai.rs +++ b/utils/zerovec/benches/zerovec_iai.rs @@ -2,6 +2,8 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use iai::black_box; #[path = "../src/samples.rs"] diff --git a/utils/zerovec/benches/zerovec_serde.rs b/utils/zerovec/benches/zerovec_serde.rs index 08cac38d764..236344e966b 100644 --- a/utils/zerovec/benches/zerovec_serde.rs +++ b/utils/zerovec/benches/zerovec_serde.rs @@ -2,6 +2,13 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow( + clippy::unwrap_used, + clippy::expect_used, + clippy::panic, + clippy::indexing_slicing +)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use criterion::{black_box, criterion_group, criterion_main, Criterion}; use rand::SeedableRng; use rand_distr::{Distribution, LogNormal}; diff --git a/utils/zerovec/derive/examples/derives.rs b/utils/zerovec/derive/examples/derives.rs index 286ad5ff5f1..765cbbc64a4 100644 --- a/utils/zerovec/derive/examples/derives.rs +++ b/utils/zerovec/derive/examples/derives.rs @@ -2,6 +2,14 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow( + clippy::unwrap_used, + clippy::expect_used, + clippy::panic, + clippy::indexing_slicing +)] // https://github.com/rust-lang/rust-clippy/issues/13981 +#![allow(missing_debug_implementations)] + use zerovec::ule::AsULE; use zerovec::ule::EncodeAsVarULE; use zerovec::*; diff --git a/utils/zerovec/derive/examples/make.rs b/utils/zerovec/derive/examples/make.rs index 2972760342e..899ade730ec 100644 --- a/utils/zerovec/derive/examples/make.rs +++ b/utils/zerovec/derive/examples/make.rs @@ -2,6 +2,13 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow( + clippy::unwrap_used, + clippy::expect_used, + clippy::panic, + clippy::indexing_slicing +)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use std::fmt::Debug; use ule::ULE; use zerovec::*; diff --git a/utils/zerovec/derive/examples/make_var.rs b/utils/zerovec/derive/examples/make_var.rs index fa93de2ef38..85bfa16e17a 100644 --- a/utils/zerovec/derive/examples/make_var.rs +++ b/utils/zerovec/derive/examples/make_var.rs @@ -2,6 +2,13 @@ // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). +#![allow( + clippy::unwrap_used, + clippy::expect_used, + clippy::panic, + clippy::indexing_slicing +)] // https://github.com/rust-lang/rust-clippy/issues/13981 + use std::borrow::Cow; use std::fmt::Debug; diff --git a/utils/zerovec/derive/src/lib.rs b/utils/zerovec/derive/src/lib.rs index 70a4e43da5b..69b353e5e57 100644 --- a/utils/zerovec/derive/src/lib.rs +++ b/utils/zerovec/derive/src/lib.rs @@ -5,8 +5,12 @@ //! Proc macros for generating `ULE`, `VarULE` impls and types for the `zerovec` crate // Proc macro -#![allow(clippy::indexing_slicing, clippy::panic, clippy::unwrap_used, clippy::expect_used)] - +#![allow( + clippy::indexing_slicing, + clippy::panic, + clippy::unwrap_used, + clippy::expect_used +)] use proc_macro::TokenStream; use syn::{parse_macro_input, DeriveInput, Ident}; diff --git a/utils/zerovec/examples/zv_serde.rs b/utils/zerovec/examples/zv_serde.rs index d94dfa9d683..d13decaa544 100644 --- a/utils/zerovec/examples/zv_serde.rs +++ b/utils/zerovec/examples/zv_serde.rs @@ -5,6 +5,7 @@ // This example demonstrates zero-copy, zero-allocation deserialization of a u32 vector // stored in a Bincode buffer. +#![allow(clippy::unwrap_used, clippy::expect_used)] // https://github.com/rust-lang/rust-clippy/issues/13981 #![no_main] // https://github.com/unicode-org/icu4x/issues/395 icu_benchmark_macros::instrument!(); diff --git a/utils/zerovec/src/lib.rs b/utils/zerovec/src/lib.rs index bc19297d21b..3dfd4b0fcf3 100644 --- a/utils/zerovec/src/lib.rs +++ b/utils/zerovec/src/lib.rs @@ -198,6 +198,8 @@ // this crate does a lot of nuanced lifetime manipulation, being explicit // is better here. #![allow(clippy::needless_lifetimes)] +// TODO: until we can enable allow-indexing-slicing-in-tests +#![cfg_attr(test, allow(clippy::indexing_slicing))] extern crate alloc;