Skip to content

Commit

Permalink
Lock down nightly version for reproducible builds
Browse files Browse the repository at this point in the history
* Use nightly-2024-10-21
* Fix clippy lints
* Change nextest version to 0.9.81 in all places
  • Loading branch information
bantonsson committed Oct 23, 2024
1 parent 8d6b9cc commit 6e7ce4c
Show file tree
Hide file tree
Showing 31 changed files with 43 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
swap-storage: true
- uses: actions/checkout@v4
- name: Install Rust
run: rustup install nightly && rustup default nightly
run: rustup install nightly-2024-10-21 && rustup default nightly-2024-10-21
- name: Install Protoc Binary
shell: bash
run: chmod +x ./scripts/install-protoc.sh && ./scripts/install-protoc.sh $HOME
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
run: |
set -e
rustup set profile minimal
rustup toolchain install nightly
rustup default nightly
rustup toolchain install nightly-2024-10-21
rustup default nightly-2024-10-21
- uses: taiki-e/install-action@v2
with:
tool: cargo-bolero
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@ jobs:
uses: actions/checkout@v4
- name: Cache
uses: ./.github/actions/cache
- name: Install latest nightly toolchain and rustfmt
run: rustup update nightly && rustup default nightly && rustup component add rustfmt
- name: Install nightly-2024-10-21 toolchain and rustfmt
run: rustup install nightly-2024-10-21 && rustup default nightly-2024-10-21 && rustup component add rustfmt
- run: cargo fmt --all -- --check
clippy:
name: "clippy #${{ matrix.platform }} ${{ matrix.rust_version }}"
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
# Ignore nightly for now, it fails too often
rust_version: ["1.76.0", "stable"]
rust_version: ["1.76.0", "stable", "nightly-2024-10-21"]
platform: [windows-latest, ubuntu-latest]
steps:
- name: Checkout sources
Expand All @@ -49,7 +48,7 @@ jobs:
shell: bash
run: |
# shellcheck disable=SC2046
cargo clippy --workspace --all-targets --all-features -- -D warnings $([ ${{ matrix.rust_version }} = 1.76.0 ] && echo -Aunknown-lints -Ainvalid_reference_casting -Aclippy::redundant-closure-call)
cargo clippy --workspace --all-targets --all-features -- -D warnings $([ ${{ matrix.rust_version }} = 1.76.0 ] || [ ${{ matrix.rust_version }} = stable ] && echo -Aunknown-lints -Ainvalid_reference_casting -Aclippy::redundant-closure-call)
licensecheck:
runs-on: ubuntu-latest
name: "Presence of licence headers"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/miri.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
run: |
set -e
rustup set profile minimal
rustup toolchain install nightly --component miri
rustup default nightly
rustup toolchain install nightly-2024-10-21 --component miri
rustup default nightly-2024-10-21
- name: Install Protoc Binary
shell: bash
run: chmod +x ./scripts/install-protoc.sh && ./scripts/install-protoc.sh $HOME
- uses: taiki-e/install-action@v2
with:
tool: [email protected].68
tool: [email protected].81
- run: MIRIFLAGS="-Zmiri-disable-isolation" cargo miri nextest run
# We need to disable isolation because
# "unsupported operation: `clock_gettime` with `REALTIME` clocks not available when isolation is enabled"
5 changes: 1 addition & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Install cargo nextest
uses: taiki-e/install-action@v2
with:
tool: [email protected].72
tool: [email protected].81
- name: "Remove nextest CI report"
shell: bash
run: rm -rf target/nextest/ci/junit.xml
Expand Down Expand Up @@ -128,9 +128,6 @@ jobs:
rust_version: ${{ matrix.rust_version }}
build_profile: "release"

- name: Install nightly toolchain
run: rustup install nightly

- name: Install Rust ${{ matrix.rust_version }}
if: matrix.rust_version != ''
run: rustup install ${{ matrix.rust_version }} && rustup default ${{ matrix.rust_version }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ cargo nextest run
The simplest way to install [cargo-nextest][nt] is to use `cargo install` like this.

```bash
cargo install --locked '[email protected].67'
cargo install --locked '[email protected].81'
```

#### Skipping tracing integration tests
Expand Down
1 change: 0 additions & 1 deletion bin_tests/src/bin/test_the_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@

/// This is an empty binary used to test the machinery of building bins
/// in cargo test works

fn main() {}
1 change: 1 addition & 0 deletions bin_tests/tests/crashtracker_bin_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ fn crash_tracking_empty_endpoint_stdin() {
}

#[cfg(unix)]
#[allow(clippy::zombie_processes)]
fn crash_tracking_empty_endpoint_inner(receiver_type: ReceiverType) {
use std::os::unix::net::UnixListener;

Expand Down
1 change: 1 addition & 0 deletions builder/build/arch/apple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub const PROF_STATIC_LIB_FFI: &str = "libdatadog_profiling_ffi.a";
pub const REMOVE_RPATH: bool = true;
pub const BUILD_CRASHTRACKER: bool = true;

#[allow(clippy::zombie_processes)]
pub fn fix_rpath(lib_path: &str) {
if REMOVE_RPATH {
let lib_name = lib_path.split('/').last().unwrap();
Expand Down
1 change: 1 addition & 0 deletions builder/build/arch/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub const PROF_STATIC_LIB_FFI: &str = "libdatadog_profiling_ffi.a";
pub const REMOVE_RPATH: bool = false;
pub const BUILD_CRASHTRACKER: bool = true;

#[allow(clippy::zombie_processes)]
pub fn fix_rpath(lib_path: &str) {
if REMOVE_RPATH {
Command::new("patchelf")
Expand Down
1 change: 0 additions & 1 deletion crashtracker-ffi/src/collector/spans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ pub unsafe extern "C" fn ddog_crasht_insert_trace_id(id_high: u64, id_low: u64)
/// https://blog.rust-lang.org/2024/03/30/i128-layout-update.html
/// We're currently locked into 1.76.0, have to do an ugly workaround involving 2 64 bit ints
/// until we can upgrade.

///
/// # Safety
/// No safety concerns.
Expand Down
2 changes: 1 addition & 1 deletion data-pipeline/src/health_metrics.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/
// SPDX-License-Identifier: Apache-2.0

/// health_metrics holds data to emit info about the health of the data-pipeline
//! health_metrics holds data to emit info about the health of the data-pipeline

pub(crate) const STAT_SEND_TRACES: &str = "datadog.libdatadog.send.traces";
pub(crate) const STAT_SEND_TRACES_ERRORS: &str = "datadog.libdatadog.send.traces.errors";
Expand Down
8 changes: 4 additions & 4 deletions ddcommon-ffi/src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ impl<'a, T: 'a> core::ops::Deref for Slice<'a, T> {
}
}

impl<'a, T: Debug> Debug for Slice<'a, T> {
impl<T: Debug> Debug for Slice<'_, T> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
self.as_slice().fmt(f)
}
}

impl<'a, T: Eq> PartialEq<Self> for Slice<'a, T> {
impl<T: Eq> PartialEq<Self> for Slice<'_, T> {
fn eq(&self, other: &Self) -> bool {
**self == **other
}
}

impl<'a, T: Eq> Eq for Slice<'a, T> {}
impl<T: Eq> Eq for Slice<'_, T> {}

/// Use to represent strings -- should be valid UTF-8.
pub type CharSlice<'a> = Slice<'a, c_char>;
Expand Down Expand Up @@ -147,7 +147,7 @@ impl<'a, T: 'a> Slice<'a, T> {
}
}

impl<'a, T> Default for Slice<'a, T> {
impl<T> Default for Slice<'_, T> {
fn default() -> Self {
Self::empty()
}
Expand Down
4 changes: 2 additions & 2 deletions ddcommon/src/connector/named_pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ pub fn named_pipe_path_from_uri(uri: &hyper::Uri) -> anyhow::Result<PathBuf> {
)
.map_err(|_| super::errors::Error::InvalidUrl)?;

return match String::from_utf8(path) {
match String::from_utf8(path) {
Ok(s) => Ok(PathBuf::from(s.as_str())),
_ => Err(super::errors::Error::InvalidUrl.into()),
};
}
}

#[test]
Expand Down
2 changes: 2 additions & 0 deletions ddcommon/src/entity_id/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ fn compute_entity_id(

fn get_cgroup_path() -> &'static str {
// Safety: we assume set_cgroup_file is not called when it shouldn't
#[allow(static_mut_refs)]
unsafe {
TESTING_CGROUP_PATH
.as_deref()
Expand All @@ -68,6 +69,7 @@ fn get_cgroup_path() -> &'static str {

fn get_cgroup_mount_path() -> &'static str {
// Safety: we assume set_cgroup_file is not called when it shouldn't
#[allow(static_mut_refs)]
unsafe {
TESTING_CGROUP_MOUNT_PATH
.as_deref()
Expand Down
2 changes: 1 addition & 1 deletion ddtelemetry/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ pub struct MetricContextGuard<'a> {
guard: MutexGuard<'a, InnerMetricContexts>,
}

impl<'a> MetricContextGuard<'a> {
impl MetricContextGuard<'_> {
pub fn read(&self, key: ContextKey) -> Option<&MetricContext> {
self.guard.store.get(key.0 as usize)
}
Expand Down
4 changes: 2 additions & 2 deletions ipc/tarpc/plugins/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ struct ServiceGenerator<'a> {
derive_serialize: Option<&'a TokenStream2>,
}

impl<'a> ServiceGenerator<'a> {
impl ServiceGenerator<'_> {
fn trait_service(&self) -> TokenStream2 {
let &Self {
attrs,
Expand Down Expand Up @@ -762,7 +762,7 @@ impl<'a> ServiceGenerator<'a> {
}
}

impl<'a> ToTokens for ServiceGenerator<'a> {
impl ToTokens for ServiceGenerator<'_> {
fn to_tokens(&self, output: &mut TokenStream2) {
output.extend(vec![
self.trait_service(),
Expand Down
1 change: 1 addition & 0 deletions ipc/tarpc/plugins/tests/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ trait Foo {

#[test]
fn type_generation_works() {
#[allow(non_local_definitions)]
#[tarpc::server]
impl Foo for () {
async fn two_part(self, _: context::Context, s: String, i: i32) -> (String, i32) {
Expand Down
4 changes: 2 additions & 2 deletions live-debugger-ffi/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct CharSliceVec<'a> {
pub string_count: usize,
}

impl<'a> Drop for CharSliceVec<'a> {
impl Drop for CharSliceVec<'_> {
fn drop(&mut self) {
unsafe {
Vec::from_raw_parts(
Expand Down Expand Up @@ -131,7 +131,7 @@ impl<'a> From<&'a datadog_live_debugger::SpanDecorationProbe> for SpanDecoration
#[no_mangle]
extern "C" fn drop_span_decoration_probe(_: SpanDecorationProbe) {}

impl<'a> Drop for SpanDecorationProbe<'a> {
impl Drop for SpanDecorationProbe<'_> {
fn drop(&mut self) {
unsafe {
let tags = Vec::from_raw_parts(
Expand Down
1 change: 1 addition & 0 deletions live-debugger-ffi/src/evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ struct EvalCtx<'e> {

impl<'e> EvalCtx<'e> {
fn new(context: &'e mut c_void) -> Self {
#[allow(static_mut_refs)]
EvalCtx {
context,
eval: unsafe { FFI_EVALUATOR.as_ref().unwrap() },
Expand Down
2 changes: 1 addition & 1 deletion live-debugger/src/expr_defs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub enum Condition {

struct NonAssocBoolOp<'a>(&'a Condition, bool);

impl<'a> Display for NonAssocBoolOp<'a> {
impl Display for NonAssocBoolOp<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
if self.1 {
write!(f, "({})", self.0)
Expand Down
4 changes: 2 additions & 2 deletions live-debugger/src/expr_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub enum IntermediateValue<'a, I> {
Referenced(&'a I),
}

impl<'a, I> Clone for IntermediateValue<'a, I> {
impl<I> Clone for IntermediateValue<'_, I> {
fn clone(&self) -> Self {
match self {
IntermediateValue::String(s) => IntermediateValue::String(s.clone()),
Expand Down Expand Up @@ -235,7 +235,7 @@ struct Eval<'a, 'e, I, E: Evaluator<'e, I>> {
it: Option<&'e I>,
}

impl<'a, 'e, I, E: Evaluator<'e, I>> Eval<'a, 'e, I, E> {
impl<'e, I, E: Evaluator<'e, I>> Eval<'_, 'e, I, E> {
fn iref_string(&mut self, value: &'e I) -> Cow<'e, str> {
self.eval.get_string(value)
}
Expand Down
2 changes: 1 addition & 1 deletion profiling/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub struct Label<'a> {
pub num_unit: Option<&'a str>,
}

impl<'a> Label<'a> {
impl Label<'_> {
pub fn uses_at_most_one_of_str_and_num(&self) -> bool {
self.str.is_none() || (self.num == 0 && self.num_unit.is_none())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
///
/// For various tests such as using MIRI, it's too slow to decompress, open,
/// parse, and extract the strings on-demand.
pub const WORDPRESS_STRINGS: [&str; 1059] = [
pub static WORDPRESS_STRINGS: [&str; 1059] = [
"",
"sample",
"count",
Expand Down
2 changes: 1 addition & 1 deletion remote-config/src/fetch/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub struct ConfigFetcherFilesLock<'a, S> {
inner: MutexGuard<'a, HashMap<Arc<RemoteConfigPath>, StoredTargetFile<S>>>,
}

impl<'a, S> ConfigFetcherFilesLock<'a, S> {
impl<S> ConfigFetcherFilesLock<'_, S> {
/// Actually remove the file from the known files.
/// It may only be expired if already marked as expiring.
pub fn expire_file(&mut self, path: &RemoteConfigPath) {
Expand Down
2 changes: 1 addition & 1 deletion remote-config/src/file_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub struct RawFile<P> {

pub struct RawFileContentsGuard<'a, P>(MutexGuard<'a, RawFileData<P>>);

impl<'a, P> Deref for RawFileContentsGuard<'a, P> {
impl<P> Deref for RawFileContentsGuard<'_, P> {
type Target = P;

fn deref(&self) -> &Self::Target {
Expand Down
2 changes: 1 addition & 1 deletion remote-config/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl RemoteConfigPath {
}
}

impl<'a> Display for RemoteConfigPathRef<'a> {
impl Display for RemoteConfigPathRef<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self.source {
RemoteConfigSource::Datadog(id) => write!(
Expand Down
2 changes: 1 addition & 1 deletion remote-config/src/targets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl<'a> TargetsList<'a> {
}
}

impl<'a> TargetData<'a> {
impl TargetData<'_> {
pub fn try_parse_version(&self) -> Option<u64> {
self.custom
.get("v")
Expand Down
2 changes: 1 addition & 1 deletion sidecar/src/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ where
map: &'a TemporarilyRetainedMap<K, V>,
}

impl<'a, K, V> Drop for TemporarilyRetainedMapGuard<'a, K, V>
impl<K, V> Drop for TemporarilyRetainedMapGuard<'_, K, V>
where
K: TemporarilyRetainedKeyParser<V> + Clone + Eq + Hash,
{
Expand Down
2 changes: 1 addition & 1 deletion sidecar/src/one_way_shared_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ where
OneWayShmReader<T, D>: ReaderOpener<T>,
{
// bool is true when it changed
pub fn read<'a>(&'a mut self) -> (bool, &[u8]) {
pub fn read<'a>(&'a mut self) -> (bool, &'a [u8]) {
if let Some(ref handle) = self.handle {
let source_data: &RawData =
unsafe { reinterpret_u8_as_u64_slice(handle.as_slice()) }.into();
Expand Down
1 change: 1 addition & 0 deletions spawn_worker/src/win32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ impl SpawnWorker {
}
}

#[allow(clippy::manual_c_str_literals)] // c"NUL" from 1.77 and up
fn open_null(read: bool) -> HANDLE {
let mut sa = SECURITY_ATTRIBUTES {
nLength: std::mem::size_of::<SECURITY_ATTRIBUTES>() as DWORD,
Expand Down

0 comments on commit 6e7ce4c

Please sign in to comment.