Skip to content

Commit

Permalink
Fix CI and force inline for nightly functions
Browse files Browse the repository at this point in the history
  • Loading branch information
xFrednet committed Feb 15, 2022
1 parent fc36a7c commit cad1b71
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion clippy_dev/src/update_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,13 @@ fn gen_nightly_lint_list<'a>(
internal_lints: impl Iterator<Item = &'a Lint>,
usable_lints: impl Iterator<Item = &'a Lint>,
) -> String {
let details: Vec<_> = internal_lints
let mut details: Vec<_> = internal_lints
.map(|l| (false, l))
.chain(usable_lints.map(|l| (true, l)))
.filter(|(_, l)| l.version.as_ref().map_or(false, |v| v == "nightly"))
.map(|(p, l)| (p, &l.module, l.name.to_uppercase()))
.collect();
details.sort_unstable();

let mut output = GENERATED_FILE_COMMENT.to_string();
output.push_str("clippy_utils::nightly::set_nightly_lints([\n");
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/lib.nightly_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
clippy_utils::nightly::set_nightly_lints([
#[cfg(feature = "internal")]
LintId::of(utils::internal_lints::FOREVER_NIGHTLY_LINT),
LintId::of(transmute::TRANSMUTE_UNDEFINED_REPR),
LintId::of(borrow_as_ptr::BORROW_AS_PTR),
LintId::of(manual_bits::MANUAL_BITS),
LintId::of(default_union_representation::DEFAULT_UNION_REPRESENTATION),
LintId::of(manual_bits::MANUAL_BITS),
LintId::of(transmute::TRANSMUTE_UNDEFINED_REPR),
])
5 changes: 3 additions & 2 deletions clippy_utils/src/nightly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn eval_is_nightly_run(sess: &Session) {
///
/// See [`Session::is_nightly_build(&self)`] if you want to check if the current build is a nightly
/// build.
#[inline]
#[inline(always)]
pub fn is_nightly_run() -> bool {
*IS_NIGHTLY_RUN.get().unwrap_or(&false)
}
Expand All @@ -60,7 +60,7 @@ pub fn set_nightly_lints<const N: usize>(lints: [LintId; N]) {
///
/// Please use [`is_nightly_run`] to determine if Clippy's nightly features
/// should be enabled.
#[inline]
#[inline(always)]
pub fn is_nightly_lint(lint: &'static Lint) -> bool {
NIGHTLY_LINTS
.get()
Expand All @@ -69,6 +69,7 @@ pub fn is_nightly_lint(lint: &'static Lint) -> bool {

/// This function checks if the given lint is a nightly lint and should be suppressed in the current
/// context.
#[inline(always)]
pub fn suppress_lint<T: LintLevelProvider>(cx: &T, lint: &'static Lint) -> bool {
if !is_nightly_run() && is_nightly_lint(lint) {
let (_, level_src) = cx.get_lint_level(lint);
Expand Down

0 comments on commit cad1b71

Please sign in to comment.