---
clippy:
    description: Lint rust
    include:
        - browser/components/shell/rust/shell_windows/
        - build/workspace-hack/
        - browser/app/nmhproxy/
        - dom/base/fragmentdirectives/
        - dom/base/rust/
        - dom/base/speculationrules/
        - dom/fs/parent/rust/data-encoding-ffi/
        - dom/fs/parent/rust/mime-guess-ffi/
        - dom/media/gtest/
        - dom/midi/midir_impl/
        - dom/origin-trials/ffi/
        - dom/webauthn/authrs_bridge/
        - dom/webauthn/libudev-sys/
        - gfx/harfbuzz_glue/
        - gfx/webrender_bindings/
        - gfx/wr/peek-poke/
        - gfx/wr/peek-poke/peek-poke-derive/
        - gfx/wr/webrender_build/
        - gfx/wr/wr_malloc_size_of/
        - image/rust/jxl/
        - intl/app_collator_glue/
        # - intl/bidi/rust/unicode-bidi-ffi/
        - intl/l10n/rust/fluent-ffi/
        - intl/l10n/rust/l10nregistry-ffi/
        # - intl/l10n/rust/l10nregistry-rs/
        - intl/l10n/rust/localization-ffi/
        - intl/locale/rust/oxilangtag-ffi/
        - ipc/rust/ipdl_utils/
        - js/src/rust/
        - js/src/rust/shared/
        - modules/libpref/init/static_prefs/
        - mozglue/static/rust/
        - netwerk/base/http-sfv/
        - netwerk/base/idna_glue/
        - netwerk/base/mozurl/
        - netwerk/base/rust-helper/
        - netwerk/base/ssl_tokens_cache/
        - netwerk/base/urlpattern_glue/
        - netwerk/base/uritemplate_glue/
        - netwerk/protocol/http/happy_eyeballs_glue/
        - netwerk/protocol/http/binary_http/
        - netwerk/protocol/http/oblivious_http/
        - netwerk/socket/neqo_glue/
        - netwerk/test/http3server/
        - security/certverifier/signature_cache/
        - security/manager/ssl/abridged_certs/
        - security/manager/ssl/crypto_hash/
        - security/manager/ssl/data_storage/
        - security/manager/ssl/ipcclientcerts/
        - security/manager/ssl/pdf_trust_anchors/
        - security/manager/ssl/qwac_trust_anchors/
        # - security/manager/ssl/rsclientcerts/
        - security/manager/ssl/rsclientcerts-util/
        - security/manager/ssl/trust_anchors/
        - security/manager/ssl/trust-anchor-build-util/
        - security/lockstore/lockstore_ffi/
        - security/lockstore/lockstore_rs/
        - security/mls/mls_gk/
        - servo/components/malloc_size_of/
        - servo/components/selectors/
        - servo/components/servo_arc/
        - servo/components/style/
        - servo/components/style_derive/
        - servo/components/style_traits/
        - servo/components/to_shmem/
        - servo/components/to_shmem_derive/
        - servo/tests/unit/malloc_size_of/
        - servo/tests/unit/style/
        - storage/rust/
        - testing/geckodriver/
        - testing/geckodriver/marionette/
        - testing/mozbase/rust/mozdevice/
        - testing/mozbase/rust/mozprofile/
        - testing/mozbase/rust/mozrunner/
        - testing/mozbase/rust/mozversion/
        - testing/webdriver/
        - third_party/rust/mp4parse/
        - third_party/rust/mp4parse_capi/
        - toolkit/components/cascade_bloom_filter/
        - toolkit/components/content-classifier/content_classifier_engine/
        # - toolkit/components/dap/ffi/
        - toolkit/components/gecko-trace/
        - toolkit/components/glean/
        - toolkit/components/kvstore/
        - toolkit/components/processtools/
        - toolkit/components/uniffi-bindgen-gecko-js/
        - toolkit/crashreporter/client/app/
        - toolkit/crashreporter/crash_helper_client/
        - toolkit/crashreporter/crash_helper_common/
        - toolkit/crashreporter/crash_helper_server/
        - toolkit/crashreporter/crashping/
        - toolkit/crashreporter/minidump-analyzer/
        - toolkit/crashreporter/mozannotation_client/
        - toolkit/crashreporter/mozannotation_server/
        - toolkit/crashreporter/mozwer-rust/
        - toolkit/crashreporter/process_reader/
        - toolkit/crashreporter/rust_minidump_writer_linux/
        # - toolkit/library/buildid_reader/
        - toolkit/library/buildid_reader/ffi/
        - toolkit/library/gtest/rust/
        - toolkit/library/rust/
        - toolkit/xre/detect_win32k_conflicts/
        - tools/fuzzing/rust/
        - tools/lint/mozcheck/
        - widget/windows/rust/
        # - tools/profiler/rust-api/
        # - xpcom/rust/gecko_logger/
        - xpcom/rust/gecko_tracing/
        - xpcom/rust/gtest/bench-collections/
        - xpcom/rust/malloc_size_of_derive/
        - xpcom/rust/xpcom/xpcom_macros/
    non_gkrust_crates:
        # Crates to run clippy on that aren't part of the gkrust crate
        # (`toolkit/library/rust/`). These have the form of
        # [crate-name]: [crate-dir]
        #
        # Make sure to include the crate dir in `includes` as well.
        uniffi-bindgen-gecko-js: toolkit/components/uniffi-bindgen-gecko-js/
    exclude:
        # Many are failing for the same reasons:
        # https://bugzilla.mozilla.org/show_bug.cgi?id=1606073
        # https://bugzilla.mozilla.org/show_bug.cgi?id=1606077
        - Cargo.toml
        # nsstring
        # derive_hash_xor_eq
        - gfx/wr/
        - gfx/wr/webrender/
        - gfx/wr/examples/
        # windows-only
        - gfx/wr/example-compositor/compositor-windows/
        - gfx/wr/webrender_api/
        - gfx/wr/wrench/
        - gfx/wgpu_bindings/
        # not_unsafe_ptr_arg_deref
        - modules/libpref/parser/
        - tools/profiler/rust-helper/
        - toolkit/library/rust/shared/
        - dom/media/webrtc/sdp/rsdparsa_capi/
        - intl/encoding_glue/
        - storage/variant/
        # nsstring
        - servo/ports/geckolib/tests/
        - xpcom/rust/xpcom/
        - xpcom/rust/nsstring/
        - xpcom/rust/gtest/xpcom/
        - xpcom/rust/gtest/nsstring/
        - security/manager/ssl/cert_storage/
        - intl/locale/rust/fluent-langneg-ffi/
        - intl/locale/rust/locale_service_glue/
        - intl/locale/rust/unic-langid-ffi/
        - toolkit/components/places/bookmark_sync/
        - xpcom/rust/nserror/
        - xpcom/rust/moz_task/
        - xpcom/rust/gkrust_utils/
        - dom/media/webrtc/transport/mdns_service/
        - tools/lint/test/files/clippy/
        - servo/ports/geckolib/
        - toolkit/components/bitsdownload/bits_client/
        - gfx/wr/example-compositor/compositor/
        - toolkit/components/bitsdownload/bits_client/bits/
        # mac and windows only
        - security/manager/ssl/osclientcerts/
    # enable the `all`, `cargo` and `pedantic` lint groups plus the `use_self`
    # nursery lint, then opt back out of the individual lints below. The allows
    # are emitted as `-A` flags after the group `-W` flags so they take effect.
    warn:
        - all
        - cargo
        - pedantic
        - use_self
        - needless_return
    allow:
        - cargo_common_metadata
        - multiple_crate_versions
        - missing_errors_doc
        - missing_panics_doc
        - must_use_candidate
        - cast_possible_truncation
        - too_many_lines
        - cast_possible_wrap
        - cast_sign_loss
        - struct_excessive_bools
        - cast_precision_loss
        - cast_lossless
        - ignored_unit_patterns
        - similar_names
        - float_cmp
        - return_self_not_must_use
        - fn_params_excessive_bools
        - used_underscore_items
        - should_panic_without_expect
        - doc_markdown
        - unused_self
        - enum_glob_use
        - unnested_or_patterns
        - implicit_hasher
        - doc_link_with_quotes
        - format_push_string
        - flat_map_option
        - from_iter_instead_of_collect
        - large_types_passed_by_value
    extensions:
        - rs
    support-files:
        - 'tools/lint/clippy/**'
    # the version of cargo-clippy is:
    # clippy 0.1.92 (ded5c06cf2 2025-12-08)
    # we use the date instead to facilitate the check
    # replacing - by . because Python packaging.version.Version expects this
    min_clippy_version: 2025.12.08
    type: global
    payload: clippy:lint
