Skip to content

Commit

Permalink
Update lints to use soon to be stable config
Browse files Browse the repository at this point in the history
  • Loading branch information
udoprog committed May 24, 2024
1 parent a5e112e commit 153217b
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
- uses: Swatinem/rust-cache@v2
- run: cargo miri test -p rune-alloc --all-features

rune_nightly:
nightly:
runs-on: ubuntu-latest
needs: basics
env:
Expand Down
3 changes: 3 additions & 0 deletions crates/rune-alloc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ license = "MIT OR Apache-2.0"
keywords = ["language", "scripting", "scripting-language"]
categories = ["parser-implementations"]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(rune_nightly)'] }

[features]
default = ["std", "serde"]
std = ["alloc", "ahash/std", "serde?/std"]
Expand Down
44 changes: 0 additions & 44 deletions crates/rune-alloc/src/hashbrown/raw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3360,50 +3360,6 @@ impl<T> RawIterRange<T> {
}
}

/// Splits a `RawIterRange` into two halves.
///
/// Returns `None` if the remaining range is smaller than or equal to the
/// group width.
#[cfg_attr(feature = "inline-more", inline)]
#[cfg(feature = "rayon")]
pub(crate) fn split(mut self) -> (Self, Option<RawIterRange<T>>) {
unsafe {
if self.end <= self.next_ctrl {
// Nothing to split if the group that we are current processing
// is the last one.
(self, None)
} else {
// len is the remaining number of elements after the group that
// we are currently processing. It must be a multiple of the
// group size (small tables are caught by the check above).
let len = offset_from(self.end, self.next_ctrl);
debug_assert_eq!(len % Group::WIDTH, 0);

// Split the remaining elements into two halves, but round the
// midpoint down in case there is an odd number of groups
// remaining. This ensures that:
// - The tail is at least 1 group long.
// - The split is roughly even considering we still have the
// current group to process.
let mid = (len / 2) & !(Group::WIDTH - 1);

let tail = Self::new(
self.next_ctrl.add(mid),
self.data.next_n(Group::WIDTH).next_n(mid),
len - mid,
);
debug_assert_eq!(
self.data.next_n(Group::WIDTH).next_n(mid).ptr,
tail.data.ptr
);
debug_assert_eq!(self.end, tail.end);
self.end = self.next_ctrl.add(mid);
debug_assert_eq!(self.end.add(Group::WIDTH), tail.next_ctrl);
(self, Some(tail))
}
}
}

/// # Safety
/// If DO_CHECK_PTR_RANGE is false, caller must ensure that we never try to iterate
/// after yielding all elements.
Expand Down
1 change: 0 additions & 1 deletion crates/rune-alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
// may not be copied, modified, or distributed except according to those terms.

#![no_std]
#![allow(unexpected_cfgs)]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_doc_tests)]
#![cfg_attr(rune_nightly, deny(rustdoc::missing_doc_code_examples))]
Expand Down
3 changes: 3 additions & 0 deletions crates/rune-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ license = "MIT OR Apache-2.0"
keywords = ["language", "scripting", "scripting-language"]
categories = ["parser-implementations"]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(rune_nightly)'] }

[features]
default = ["alloc"]
doc = []
Expand Down
1 change: 0 additions & 1 deletion crates/rune-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
//! **YOU ARE NOT** supposed to depend on this directly. Doing so might cause
//! dependency errors since its API is not stable.
#![allow(unexpected_cfgs)]
#![allow(clippy::module_inception)]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_doc_tests)]
Expand Down
3 changes: 3 additions & 0 deletions crates/rune/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ license = "MIT OR Apache-2.0"
keywords = ["language", "scripting", "scripting-language"]
categories = ["parser-implementations"]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(rune_nightly, rune_docsrs, rune_byte_code)'] }

[features]
default = ["emit", "std"]
emit = ["std", "codespan-reporting"]
Expand Down
1 change: 0 additions & 1 deletion crates/rune/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
#![deny(rustdoc::private_doc_tests)]
#![cfg_attr(rune_nightly, feature(rustdoc_missing_doc_code_examples))]
#![cfg_attr(rune_nightly, deny(rustdoc::missing_doc_code_examples))]
#![allow(unexpected_cfgs)]
#![allow(clippy::enum_variant_names)]
#![allow(clippy::needless_doctest_main)]
#![allow(clippy::too_many_arguments)]
Expand Down

0 comments on commit 153217b

Please sign in to comment.