diff --git a/Cargo.toml b/Cargo.toml index ea22b4bba0b..4f345db0fc1 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 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/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 dc57ea88896..78e9fc81e42 100644 --- a/components/calendar/src/lib.rs +++ b/components/calendar/src/lib.rs @@ -95,19 +95,9 @@ // 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)] + +// TODO: until we can enable allow-indexing-slicing-in-tests +#![cfg_attr(test, allow(clippy::indexing_slicing))] extern crate alloc; 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/casemap/src/lib.rs b/components/casemap/src/lib.rs index 787214c0ce1..47f9e541f06 100644 --- a/components/casemap/src/lib.rs +++ b/components/casemap/src/lib.rs @@ -29,19 +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)] -#![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/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/collator/src/lib.rs b/components/collator/src/lib.rs index 5ebfb49ca8a..17200c5c3e0 100644 --- a/components/collator/src/lib.rs +++ b/components/collator/src/lib.rs @@ -8,19 +8,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_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/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/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..d3e22cf90c3 100644 --- a/components/collections/codepointtrie_builder/Cargo.toml +++ b/components/collections/codepointtrie_builder/Cargo.toml @@ -54,3 +54,4 @@ denylist = ["icu4c"] [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(icu4c_enable_renaming)'] } + diff --git a/components/collections/codepointtrie_builder/src/lib.rs b/components/collections/codepointtrie_builder/src/lib.rs index cbcc1052dec..467c3f2fd60 100644 --- a/components/collections/codepointtrie_builder/src/lib.rs +++ b/components/collections/codepointtrie_builder/src/lib.rs @@ -71,20 +71,6 @@ //! [`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..b03f7f62dd5 100644 --- a/components/collections/src/codepointinvlist/mod.rs +++ b/components/collections/src/codepointinvlist/mod.rs @@ -51,8 +51,6 @@ //! //! [`ICU4X`]: ../icu/index.html -#![warn(missing_docs)] - extern crate alloc; #[macro_use] diff --git a/components/collections/src/lib.rs b/components/collections/src/lib.rs index 3c37fcb4052..c9c2bebeb0d 100644 --- a/components/collections/src/lib.rs +++ b/components/collections/src/lib.rs @@ -22,16 +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)] -#![cfg_attr( - not(test), - deny( - clippy::indexing_slicing, - clippy::unwrap_used, - clippy::expect_used, - clippy::panic - ) +// TODO +#![allow( + clippy::exhaustive_structs, + clippy::exhaustive_enums, + missing_debug_implementations )] -#![warn(missing_docs)] extern crate alloc; diff --git a/components/datetime/Cargo.toml b/components/datetime/Cargo.toml index fc81c995966..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 @@ -140,3 +137,7 @@ required-features = ["experimental"] [[example]] name = "work_log" required-features = ["compiled_data"] + + +[lints] +workspace = true diff --git a/components/datetime/src/lib.rs b/components/datetime/src/lib.rs index c633dc8de07..5d2a51e93bc 100644 --- a/components/datetime/src/lib.rs +++ b/components/datetime/src/lib.rs @@ -71,19 +71,9 @@ // 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)] + +// TODO: until we can enable allow-indexing-slicing-in-tests +#![cfg_attr(test, allow(clippy::indexing_slicing))] extern crate alloc; diff --git a/components/decimal/Cargo.toml b/components/decimal/Cargo.toml index 2fd71cc1edc..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 @@ -66,3 +63,7 @@ harness = false [[example]] name = "code_line_diff" required-features = ["serde"] + + +[lints] +workspace = true diff --git a/components/decimal/src/lib.rs b/components/decimal/src/lib.rs index 15fbafe6010..2cc96da7c4b 100644 --- a/components/decimal/src/lib.rs +++ b/components/decimal/src/lib.rs @@ -77,19 +77,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_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/Cargo.toml b/components/experimental/Cargo.toml index 81ba78bb502..b763521f8f0 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" + +# No boilerplate, each module has their own +# [lints] +# workspace = true diff --git a/components/experimental/src/compactdecimal/mod.rs b/components/experimental/src/compactdecimal/mod.rs index 8d0e3b5cc95..f73ea900677 100644 --- a/components/experimental/src/compactdecimal/mod.rs +++ b/components/experimental/src/compactdecimal/mod.rs @@ -5,19 +5,6 @@ //! 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..6cae7175d38 100644 --- a/components/experimental/src/displaynames/mod.rs +++ b/components/experimental/src/displaynames/mod.rs @@ -7,19 +7,6 @@ // 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..5dacd5c5738 100644 --- a/components/experimental/src/duration/mod.rs +++ b/components/experimental/src/duration/mod.rs @@ -4,8 +4,6 @@ //! Duration formatting -#![warn(missing_docs)] - mod duration; mod format; mod formatter; diff --git a/components/experimental/src/relativetime/mod.rs b/components/experimental/src/relativetime/mod.rs index 2ca0bce9789..e51ee0f5244 100644 --- a/components/experimental/src/relativetime/mod.rs +++ b/components/experimental/src/relativetime/mod.rs @@ -4,8 +4,6 @@ //! Relative time formatting -#![warn(missing_docs)] - 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 bfa4abba072..4d0c47a747a 100644 --- a/components/experimental/src/transliterate/mod.rs +++ b/components/experimental/src/transliterate/mod.rs @@ -7,19 +7,6 @@ //! 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..d22f4a18393 100644 --- a/components/experimental/src/unicodeset_parse/mod.rs +++ b/components/experimental/src/unicodeset_parse/mod.rs @@ -11,19 +11,6 @@ //! [`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/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/icu/src/lib.rs b/components/icu/src/lib.rs index 4777bc8b8f7..a38b88eade2 100644 --- a/components/icu/src/lib.rs +++ b/components/icu/src/lib.rs @@ -128,19 +128,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_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/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/list/src/lib.rs b/components/list/src/lib.rs index 29cb8a7193d..159ef923b0e 100644 --- a/components/list/src/lib.rs +++ b/components/list/src/lib.rs @@ -73,19 +73,6 @@ //! 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/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/src/lib.rs b/components/locale/src/lib.rs index 5053913c48f..b0b0c5849e8 100644 --- a/components/locale/src/lib.rs +++ b/components/locale/src/lib.rs @@ -70,19 +70,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_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/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/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/locale_core/src/lib.rs b/components/locale_core/src/lib.rs index 6344ec4a134..2aa0fb6cff7 100644 --- a/components/locale_core/src/lib.rs +++ b/components/locale_core/src/lib.rs @@ -50,19 +50,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_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/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/normalizer/src/lib.rs b/components/normalizer/src/lib.rs index b918c8daff8..324cc92fd28 100644 --- a/components/normalizer/src/lib.rs +++ b/components/normalizer/src/lib.rs @@ -4,19 +4,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_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/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/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/pattern/src/lib.rs b/components/pattern/src/lib.rs index 192427adbb1..55323e8288c 100644 --- a/components/pattern/src/lib.rs +++ b/components/pattern/src/lib.rs @@ -32,18 +32,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_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/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/plurals/src/lib.rs b/components/plurals/src/lib.rs index 4cd4f3a547a..ee04c41a46b 100644 --- a/components/plurals/src/lib.rs +++ b/components/plurals/src/lib.rs @@ -59,19 +59,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_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/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/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/properties/src/lib.rs b/components/properties/src/lib.rs index fdbc77180b7..7c3dbe56ff2 100644 --- a/components/properties/src/lib.rs +++ b/components/properties/src/lib.rs @@ -53,19 +53,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_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/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/segmenter/src/lib.rs b/components/segmenter/src/lib.rs index f3104e08c24..cf72d53b9e7 100644 --- a/components/segmenter/src/lib.rs +++ b/components/segmenter/src/lib.rs @@ -101,19 +101,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_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/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/components/timezone/src/lib.rs b/components/timezone/src/lib.rs index 945ab9a5a7c..e98576e5121 100644 --- a/components/timezone/src/lib.rs +++ b/components/timezone/src/lib.rs @@ -84,19 +84,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_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/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/adapters/src/lib.rs b/provider/adapters/src/lib.rs index 8b5d871d431..99f5c63af26 100644 --- a/provider/adapters/src/lib.rs +++ b/provider/adapters/src/lib.rs @@ -11,19 +11,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_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/baked/Cargo.toml b/provider/baked/Cargo.toml index c99d89dd407..6d4316ee365 100644 --- a/provider/baked/Cargo.toml +++ b/provider/baked/Cargo.toml @@ -43,3 +43,8 @@ export = [ "icu_provider/export", "zerotrie/databake", ] + + +# TODO +# [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/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/src/lib.rs b/provider/blob/src/lib.rs index 738b6f23e3d..27c692f4891 100644 --- a/provider/blob/src/lib.rs +++ b/provider/blob/src/lib.rs @@ -17,19 +17,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_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/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/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/core/macros/src/lib.rs b/provider/core/macros/src/lib.rs index 86c92c5c88c..5c21285be3e 100644 --- a/provider/core/macros/src/lib.rs +++ b/provider/core/macros/src/lib.rs @@ -3,25 +3,19 @@ // (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. //! //! 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/core/src/lib.rs b/provider/core/src/lib.rs index e019dd348a6..e570459c7c6 100644 --- a/provider/core/src/lib.rs +++ b/provider/core/src/lib.rs @@ -92,19 +92,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_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/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/export/src/lib.rs b/provider/export/src/lib.rs index f819c847078..d1f9850944f 100644 --- a/provider/export/src/lib.rs +++ b/provider/export/src/lib.rs @@ -45,20 +45,13 @@ //! * `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, - ) +// Primarily used in datagen +#![allow( + clippy::indexing_slicing, + clippy::panic, + clippy::unwrap_used, + clippy::expect_used )] -#![warn(missing_docs)] 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/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/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/fs/src/lib.rs b/provider/fs/src/lib.rs index 810c5a344b1..b630a38dce9 100644 --- a/provider/fs/src/lib.rs +++ b/provider/fs/src/lib.rs @@ -77,19 +77,6 @@ //! [`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/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/icu4x-datagen/src/main.rs b/provider/icu4x-datagen/src/main.rs index c4074cfdc61..cfcd5a96e6e 100644 --- a/provider/icu4x-datagen/src/main.rs +++ b/provider/icu4x-datagen/src/main.rs @@ -25,6 +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 +)] use clap::{Parser, ValueEnum}; use eyre::WrapErr; 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/provider/source/src/lib.rs b/provider/source/src/lib.rs index c06ab16bdc2..abc420d2035 100644 --- a/provider/source/src/lib.rs +++ b/provider/source/src/lib.rs @@ -17,6 +17,14 @@ //! * `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 0e2a93ef7f7..952bb5ca3c5 100644 --- a/utils/bies/Cargo.toml +++ b/utils/bies/Cargo.toml @@ -31,3 +31,8 @@ writeable = { workspace = true } rand = { workspace = true } rand_distr = { workspace = true } rand_pcg = { workspace = true } + + +# TODO +# [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/calendrical_calculations/src/lib.rs b/utils/calendrical_calculations/src/lib.rs index 2066791f7de..aa12078885a 100644 --- a/utils/calendrical_calculations/src/lib.rs +++ b/utils/calendrical_calculations/src/lib.rs @@ -20,18 +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)] -#![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/crlify/Cargo.toml b/utils/crlify/Cargo.toml index 548a84a800f..8180631e1bf 100644 --- a/utils/crlify/Cargo.toml +++ b/utils/crlify/Cargo.toml @@ -18,3 +18,8 @@ rust-version.workspace = true [package.metadata.workspaces] independent = true + + +# TODO +# [lints] +# workspace = true diff --git a/utils/databake/Cargo.toml b/utils/databake/Cargo.toml index 7f0a0c18055..62a09d514f8 100644 --- a/utils/databake/Cargo.toml +++ b/utils/databake/Cargo.toml @@ -29,3 +29,8 @@ derive = ["dep:databake-derive"] proc-macro2 = { workspace = true } quote = { workspace = true } databake-derive = { workspace = true, optional = true} + + +# TODO +# [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/databake/derive/src/lib.rs b/utils/databake/derive/src/lib.rs index 74a01339e0c..6ce8963d694 100644 --- a/utils/databake/derive/src/lib.rs +++ b/utils/databake/derive/src/lib.rs @@ -4,6 +4,14 @@ //! 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/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, 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/deduplicating_array/examples/postcard.rs b/utils/deduplicating_array/examples/postcard.rs index af76f245466..cfebace8fe2 100644 --- a/utils/deduplicating_array/examples/postcard.rs +++ b/utils/deduplicating_array/examples/postcard.rs @@ -4,6 +4,14 @@ // 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/deduplicating_array/src/lib.rs b/utils/deduplicating_array/src/lib.rs index c122eb1a8d5..614b70c6bca 100644 --- a/utils/deduplicating_array/src/lib.rs +++ b/utils/deduplicating_array/src/lib.rs @@ -30,18 +30,6 @@ // 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/env_preferences/Cargo.toml b/utils/env_preferences/Cargo.toml index fe9021db91e..161dc155b7c 100644 --- a/utils/env_preferences/Cargo.toml +++ b/utils/env_preferences/Cargo.toml @@ -35,3 +35,8 @@ features = [ [dev-dependencies] icu_locale = { path = "../../components/locale" } + + +# TODO +# [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/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 ae70deafc57..74f23390930 100644 --- a/utils/fixed_decimal/src/lib.rs +++ b/utils/fixed_decimal/src/lib.rs @@ -38,18 +38,8 @@ // 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, - ) -)] +// TODO +#![allow(missing_docs)] mod compact; mod decimal; 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/ixdtf/src/lib.rs b/utils/ixdtf/src/lib.rs index 8f39111b84f..309df0190dc 100644 --- a/utils/ixdtf/src/lib.rs +++ b/utils/ixdtf/src/lib.rs @@ -374,18 +374,8 @@ //! [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, - ) -)] +// 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/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/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 f8aeb7dda29..3f28017ff6f 100644 --- a/utils/litemap/src/lib.rs +++ b/utils/litemap/src/lib.rs @@ -32,18 +32,8 @@ // 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, - ) -)] +// 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/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/potential_utf/src/lib.rs b/utils/potential_utf/src/lib.rs index 5ea72a92a40..00d79d25d40 100644 --- a/utils/potential_utf/src/lib.rs +++ b/utils/potential_utf/src/lib.rs @@ -3,18 +3,6 @@ // (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/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/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/resb/src/lib.rs b/utils/resb/src/lib.rs index 66404e53168..964d026925a 100644 --- a/utils/resb/src/lib.rs +++ b/utils/resb/src/lib.rs @@ -12,18 +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)] -#![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/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/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 ab1bfc4f0c6..f60f10de36b 100644 --- a/utils/tinystr/src/lib.rs +++ b/utils/tinystr/src/lib.rs @@ -53,18 +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)] -#![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, - ) -)] +// TODO: until we can enable allow-indexing-slicing-in-tests +#![cfg_attr(test, allow(clippy::indexing_slicing))] mod macros; diff --git a/utils/tzif/Cargo.toml b/utils/tzif/Cargo.toml index 6cabdc5e4d8..e36d5da644a 100644 --- a/utils/tzif/Cargo.toml +++ b/utils/tzif/Cargo.toml @@ -23,3 +23,8 @@ combine = { workspace = true } [dev-dependencies] walkdir = { workspace = true } + + +# TODO +# [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/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 ca7c773d7ee..d3bffd2d939 100644 --- a/utils/writeable/examples/writeable_message.rs +++ b/utils/writeable/examples/writeable_message.rs @@ -4,6 +4,13 @@ // 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 48d0f52457f..ffdbc6e2bd5 100644 --- a/utils/writeable/src/lib.rs +++ b/utils/writeable/src/lib.rs @@ -4,18 +4,8 @@ // 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, - ) -)] +// 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. //! 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/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 4d3d8843a4f..1a74e77e61e 100644 --- a/utils/yoke/derive/src/lib.rs +++ b/utils/yoke/derive/src/lib.rs @@ -4,6 +4,14 @@ //! 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/src/lib.rs b/utils/yoke/src/lib.rs index 26fe9614703..44e56330d12 100644 --- a/utils/yoke/src/lib.rs +++ b/utils/yoke/src/lib.rs @@ -26,18 +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)] -#![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/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/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/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/zerofrom/derive/src/lib.rs b/utils/zerofrom/derive/src/lib.rs index 67d40851e75..07160ec967d 100644 --- a/utils/zerofrom/derive/src/lib.rs +++ b/utils/zerofrom/derive/src/lib.rs @@ -5,18 +5,6 @@ //! 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..ce97ff79ad3 100644 --- a/utils/zerofrom/src/lib.rs +++ b/utils/zerofrom/src/lib.rs @@ -8,18 +8,6 @@ // 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/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/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 0f6e05f0814..65f9cce400e 100644 --- a/utils/zerotrie/src/lib.rs +++ b/utils/zerotrie/src/lib.rs @@ -36,20 +36,8 @@ // 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)] +// 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/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/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/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/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 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 9c3007147ae..69b353e5e57 100644 --- a/utils/zerovec/derive/src/lib.rs +++ b/utils/zerovec/derive/src/lib.rs @@ -4,6 +4,14 @@ //! 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; 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 2d8c34fdf11..3dfd4b0fcf3 100644 --- a/utils/zerovec/src/lib.rs +++ b/utils/zerovec/src/lib.rs @@ -195,21 +195,11 @@ // 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)] +// TODO: until we can enable allow-indexing-slicing-in-tests +#![cfg_attr(test, allow(clippy::indexing_slicing))] extern crate alloc;