Skip to content

skip compiling C++ code when running clippy #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 17, 2025
Merged

skip compiling C++ code when running clippy #16

merged 2 commits into from
Jul 17, 2025

Conversation

Firestar99
Copy link
Member

@Firestar99 Firestar99 commented Jul 11, 2025

Requires #17

@Firestar99 Firestar99 changed the title skip compiling C++ code when running clippy skip compiling C++ code when running clippy Jul 11, 2025
@Firestar99
Copy link
Member Author

newer clippy and deny versions broke stuff...

@Firestar99 Firestar99 changed the base branch from main to fix-main-ci July 14, 2025 11:11
Base automatically changed from fix-main-ci to main July 15, 2025 13:55
Copy link
Contributor

@LegNeato LegNeato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or CLIPPY or CARGO_CFG_CLIPPY ? How did you choose that one?

@Firestar99
Copy link
Member Author

Firestar99 commented Jul 15, 2025

I've added this to the build script:

let vars = std::env::vars().collect::<Vec<_>>();
panic!("vars: {vars:#?}");

Which printed only the following CLIPPY* vars:

(
    "CARGO_ENCODED_RUSTFLAGS",
    "-C\u{1f}link-arg=-fuse-ld=mold\u{1f}-Dunsafe_code\u{1f}-Wclippy::all\u{1f}-Wclippy::await_holding_lock\u{1f}-Wclippy::char_lit_as_u8\u{1f}-Wclippy::checked_conversions\u{1f}-Wclippy::dbg_macro\u{1f}-Wclippy::debug_assert_with_mut_call\u{1f}-Wclippy::doc_markdown\u{1f}-Wclippy::empty_enum\u{1f}-Wclippy::enum_glob_use\u{1f}-Wclippy::exit\u{1f}-Wclippy::expl_impl_clone_on_copy\u{1f}-Wclippy::explicit_deref_methods\u{1f}-Wclippy::explicit_into_iter_loop\u{1f}-Wclippy::fallible_impl_from\u{1f}-Wclippy::filter_map_next\u{1f}-Wclippy::flat_map_option\u{1f}-Wclippy::float_cmp_const\u{1f}-Wclippy::fn_params_excessive_bools\u{1f}-Wclippy::from_iter_instead_of_collect\u{1f}-Wclippy::if_let_mutex\u{1f}-Wclippy::implicit_clone\u{1f}-Wclippy::imprecise_flops\u{1f}-Wclippy::inefficient_to_string\u{1f}-Wclippy::invalid_upcast_comparisons\u{1f}-Wclippy::large_digit_groups\u{1f}-Wclippy::large_stack_arrays\u{1f}-Wclippy::large_types_passed_by_value\u{1f}-Wclippy::let_unit_value\u{1f}-Wclippy::linkedlist\u{1f}-Wclippy::lossy_float_literal\u{1f}-Wclippy::macro_use_imports\u{1f}-Wclippy::manual_ok_or\u{1f}-Wclippy::map_err_ignore\u{1f}-Wclippy::map_flatten\u{1f}-Wclippy::map_unwrap_or\u{1f}-Wclippy::indexing_slicing\u{1f}-Wclippy::match_same_arms\u{1f}-Wclippy::match_wild_err_arm\u{1f}-Wclippy::match_wildcard_for_single_variants\u{1f}-Wclippy::mem_forget\u{1f}-Wclippy::missing_enforced_import_renames\u{1f}-Wclippy::mut_mut\u{1f}-Wclippy::mutex_integer\u{1f}-Wclippy::needless_borrow\u{1f}-Wclippy::needless_continue\u{1f}-Wclippy::needless_for_each\u{1f}-Wclippy::option_option\u{1f}-Wclippy::path_buf_push_overwrite\u{1f}-Wclippy::ptr_as_ptr\u{1f}-Wclippy::rc_mutex\u{1f}-Wclippy::ref_option_ref\u{1f}-Wclippy::rest_pat_in_fully_bound_structs\u{1f}-Wclippy::same_functions_in_if_condition\u{1f}-Wclippy::semicolon_if_nothing_returned\u{1f}-Wclippy::single_match_else\u{1f}-Wclippy::string_add_assign\u{1f}-Wclippy::string_add\u{1f}-Wclippy::string_lit_as_bytes\u{1f}-Wclippy::string_to_string\u{1f}-Wclippy::todo\u{1f}-Wclippy::trait_duplication_in_bounds\u{1f}-Wclippy::unimplemented\u{1f}-Wclippy::unnested_or_patterns\u{1f}-Wclippy::unused_self\u{1f}-Wclippy::useless_transmute\u{1f}-Wclippy::verbose_file_reads\u{1f}-Wclippy::zero_sized_map_values\u{1f}-Wfuture_incompatible\u{1f}-Wnonstandard_style\u{1f}-Wrust_2018_idioms\u{1f}-C\u{1f}link-arg=-fuse-ld=lld",
),
(
    "CLIPPY_ARGS",
    "",
),
(
    "CLIPPY_TERMINAL_WIDTH",
    "203",
),
(
    "RUSTC_WORKSPACE_WRAPPER",
    "/home/firestar99/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/clippy-driver",
),

Could CLIPPY or CARGO_CFG_CLIPPY not be exposed in build scripts?

(also rebased it)

@LegNeato
Copy link
Contributor

How about using #[cfg(clippy)]? It seems to be officially supported:

https://doc.rust-lang.org/nightly/clippy/configuration.html#disabling-evaluation-of-certain-code

@Firestar99
Copy link
Member Author

Firestar99 commented Jul 17, 2025

How about using #[cfg(clippy)]? It seems to be officially supported:

https://doc.rust-lang.org/nightly/clippy/configuration.html#disabling-evaluation-of-certain-code

This works as well and is probably a lot cleaner than my solution. Feel free to merge. As discussed, once merged I'll release version 0.12.1 so we can start using it in rust-gpu.

@LegNeato LegNeato merged commit a90799e into main Jul 17, 2025
6 checks passed
@LegNeato LegNeato deleted the skip_clippy branch July 17, 2025 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants