Skip to content

Commit 9ba46cb

Browse files
authored
fix lints for stable (#14)
* fix lints * more lints
1 parent 9392e59 commit 9ba46cb

File tree

8 files changed

+51
-54
lines changed

8 files changed

+51
-54
lines changed

cas_client/src/data_transport.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl std::fmt::Debug for DataTransport {
7777
/// Right now this retries every h2 error. Reading these:
7878
/// - https://docs.rs/h2/latest/h2/struct.Error.html,
7979
/// - https://docs.rs/h2/latest/h2/struct.Reason.html
80-
/// unclear if there is any reason not to retry.
80+
/// unclear if there is any reason not to retry.
8181
#[derive(Error, Debug)]
8282
enum RetryError {
8383
#[error("{0}")]

file_utils/src/privilege_context.rs

Lines changed: 33 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -245,16 +245,14 @@ mod test {
245245
fn test_create_dir_all() -> anyhow::Result<()> {
246246
// Run this test manually, steps:
247247

248-
// For Unix
249-
// 1. Run the below shell script in an empty dir with standard privileges.
250-
// 2. Set env var 'XET_TEST_PATH' to this path.
251-
// 3. Build the test executable by running 'cargo test -p gitxetcore --lib --no-run'.
252-
// 4. Locate the path to the executable as TEST_EXE
253-
// 5. Run test with a non-root user: 'TEST_EXE config::permission::test::test_create_dir_all --exact --nocapture --include-ignored'
254-
255-
r#"
256-
sudo mkdir rootdir
257-
"#;
248+
/* For Unix
249+
1. Run the below shell script in an empty dir with standard privileges.
250+
2. Set env var 'XET_TEST_PATH' to this path.
251+
3. Build the test executable by running 'cargo test -p gitxetcore --lib --no-run'.
252+
4. Locate the path to the executable as TEST_EXE
253+
5. Run test with a non-root user: 'TEST_EXE config::permission::test::test_create_dir_all --exact --nocapture --include-ignored'
254+
sudo mkdir rootdir
255+
*/
258256

259257
let test_path = std::env::var("XET_TEST_PATH")?;
260258
std::env::set_current_dir(test_path)?;
@@ -273,16 +271,15 @@ sudo mkdir rootdir
273271
fn test_create_dir_all_sudo() -> anyhow::Result<()> {
274272
// Run this test manually, steps:
275273

276-
// For Unix
277-
// 1. Run the below shell script in an empty dir with standard privileges.
278-
// 2. Set env var 'XET_TEST_PATH' to this path.
279-
// 3. Build the test executable by running 'cargo test -p gitxetcore --lib --no-run'.
280-
// 4. Locate the path to the executable as TEST_EXE
281-
// 5. Run test with root user: 'sudo -E TEST_EXE config::permission::test::test_create_dir_all_sudo --exact --nocapture --include-ignored'
274+
/* For Unix
275+
1. Run the below shell script in an empty dir with standard privileges.
276+
2. Set env var 'XET_TEST_PATH' to this path.
277+
3. Build the test executable by running 'cargo test -p gitxetcore --lib --no-run'.
278+
4. Locate the path to the executable as TEST_EXE
279+
5. Run test with a non-root user: 'sudo -E TEST_EXE config::permission::test::test_create_dir_all_sudo --exact --nocapture --include-ignored'
282280
283-
r#"
284-
mkdir regdir
285-
"#;
281+
mkdir regdir
282+
*/
286283

287284
let test_path = std::env::var("XET_TEST_PATH")?;
288285
std::env::set_current_dir(test_path)?;
@@ -310,17 +307,16 @@ mkdir regdir
310307
fn test_create_file() -> anyhow::Result<()> {
311308
// Run this test manually, steps:
312309

313-
// For Unix
314-
// 1. Run the below shell script in an empty dir with standard privileges.
315-
// 2. Set env var 'XET_TEST_PATH' to this path.
316-
// 3. Build the test executable by running 'cargo test -p gitxetcore --lib --no-run'.
317-
// 4. Locate the path to the executable as TEST_EXE
318-
// 5. Run test with a non-root user: 'TEST_EXE config::permission::test::test_create_file --exact --nocapture --include-ignored'
310+
/* For Unix
311+
1. Run the below shell script in an empty dir with standard privileges.
312+
2. Set env var 'XET_TEST_PATH' to this path.
313+
3. Build the test executable by running 'cargo test -p gitxetcore --lib --no-run'.
314+
4. Locate the path to the executable as TEST_EXE
315+
5. Run test with a non-root user: 'TEST_EXE config::permission::test::test_create_file --exact --nocapture --include-ignored'
319316
320-
r#"
321-
sudo mkdir rootdir
322-
sudo touch rootdir/file
323-
"#;
317+
sudo mkdir rootdir
318+
sudo touch rootdir/file
319+
*/
324320

325321
let test_path = std::env::var("XET_TEST_PATH")?;
326322
std::env::set_current_dir(test_path)?;
@@ -345,16 +341,14 @@ sudo touch rootdir/file
345341
fn test_create_file_sudo() -> anyhow::Result<()> {
346342
// Run this test manually, steps:
347343

348-
// For Unix
349-
// 1. Run the below shell script in an empty dir with standard privileges.
350-
// 2. Set env var 'XET_TEST_PATH' to this path.
351-
// 3. Build the test executable by running 'cargo test -p gitxetcore --lib --no-run'.
352-
// 4. Locate the path to the executable as TEST_EXE
353-
// 5. Run test with root user: 'sudo -E TEST_EXE config::permission::test::test_create_file_sudo --exact --nocapture --include-ignored'
354-
355-
r#"
356-
mkdir regdir
357-
"#;
344+
/* For Unix
345+
1. Run the below shell script in an empty dir with standard privileges.
346+
2. Set env var 'XET_TEST_PATH' to this path.
347+
3. Build the test executable by running 'cargo test -p gitxetcore --lib --no-run'.
348+
4. Locate the path to the executable as TEST_EXE
349+
5. Run test with a non-root user: 'sudo -E TEST_EXE config::permission::test::test_create_file_sudo --exact --nocapture --include-ignored'
350+
mkdir regdir
351+
*/
358352

359353
let test_path = std::env::var("XET_TEST_PATH")?;
360354
std::env::set_current_dir(test_path)?;

mdb_shard/src/set_operations.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,12 +381,14 @@ mod tests {
381381
std::fs::OpenOptions::new()
382382
.write(true)
383383
.create(true)
384+
.truncate(true)
384385
.open(&shard_path_1)?
385386
.write_all(&disk_shard_1[..])?;
386387

387388
std::fs::OpenOptions::new()
388389
.write(true)
389390
.create(true)
391+
.truncate(true)
390392
.open(&shard_path_2)?
391393
.write_all(&disk_shard_2[..])?;
392394

merkledb/benches/rolling_hash_benchmark.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@ impl SumHash {
4949
let mut bytehash: [u32; 256] = [0; 256];
5050
if seed > 0 {
5151
let mut rng = ChaChaRng::seed_from_u64(seed);
52+
#[allow(clippy::needless_range_loop)]
5253
for i in 0..256 {
5354
bytehash[i] = rng.next_u32();
5455
}
5556
} else {
57+
#[allow(clippy::needless_range_loop)]
5658
for i in 0..256 {
5759
bytehash[i] = i as u32;
5860
}
@@ -189,6 +191,7 @@ impl GearHash {
189191
pub fn init(mask: u32, seed: u64) -> GearHash {
190192
let mut rng = ChaChaRng::seed_from_u64(seed);
191193
let mut bytehash: [u32; 256] = [0; 256];
194+
#[allow(clippy::needless_range_loop)]
192195
for i in 0..256 {
193196
bytehash[i] = rng.next_u32();
194197
}

xet_error/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ trybuild = { version = "1.0.81", features = ["diff"] }
2424
[package.metadata.docs.rs]
2525
targets = ["x86_64-unknown-linux-gnu"]
2626
rustdoc-args = ["--generate-link-to-definition"]
27+
28+
[features]
29+
error_generic_member_access = []

xet_error/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,10 @@
235235
clippy::return_self_not_must_use,
236236
clippy::wildcard_imports
237237
)]
238-
#![cfg_attr(error_generic_member_access, feature(error_generic_member_access))]
239238

240239
mod aserror;
241240
mod display;
242-
#[cfg(error_generic_member_access)]
241+
#[cfg(feature = "error_generic_member_access")]
243242
mod provide;
244243

245244
pub use xet_error_impl::*;
@@ -251,7 +250,7 @@ pub mod __private {
251250
pub use crate::aserror::AsDynError;
252251
#[doc(hidden)]
253252
pub use crate::display::AsDisplay;
254-
#[cfg(error_generic_member_access)]
253+
#[cfg(feature = "error_generic_member_access")]
255254
#[doc(hidden)]
256255
pub use crate::provide::ThiserrorProvide;
257256
}

xet_error/tests/test_backtrace.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
#![cfg_attr(xet_error_nightly_testing, feature(error_generic_member_access))]
2-
31
use xet_error::Error;
42

53
#[derive(Error, Debug)]
64
#[error("...")]
75
pub struct Inner;
86

9-
#[cfg(xet_error_nightly_testing)]
7+
#[cfg(feature = "error_generic_member_access")]
108
#[derive(Error, Debug)]
119
#[error("...")]
1210
pub struct InnerBacktrace {
1311
backtrace: std::backtrace::Backtrace,
1412
}
1513

16-
#[cfg(xet_error_nightly_testing)]
14+
#[cfg(feature = "error_generic_member_access")]
1715
pub mod structs {
1816
use super::{Inner, InnerBacktrace};
1917
use std::backtrace::Backtrace;
@@ -147,7 +145,7 @@ pub mod structs {
147145
}
148146
}
149147

150-
#[cfg(xet_error_nightly_testing)]
148+
#[cfg(feature = "error_generic_member_access")]
151149
pub mod enums {
152150
use super::{Inner, InnerBacktrace};
153151
use std::backtrace::Backtrace;
@@ -270,5 +268,5 @@ pub mod enums {
270268
}
271269

272270
#[test]
273-
#[cfg_attr(not(xet_error_nightly_testing), ignore)]
271+
#[cfg_attr(not(feature = "error_generic_member_access"), ignore)]
274272
fn test_backtrace() {}

xet_error/tests/test_option.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#![cfg_attr(xet_error_nightly_testing, feature(error_generic_member_access))]
2-
3-
#[cfg(xet_error_nightly_testing)]
1+
#[cfg(feature = "error_generic_member_access")]
42
pub mod structs {
53
use std::backtrace::Backtrace;
64
use xet_error::Error;
@@ -45,7 +43,7 @@ pub mod structs {
4543
}
4644
}
4745

48-
#[cfg(xet_error_nightly_testing)]
46+
#[cfg(feature = "error_generic_member_access")]
4947
pub mod enums {
5048
use std::backtrace::Backtrace;
5149
use xet_error::Error;
@@ -101,5 +99,5 @@ pub mod enums {
10199
}
102100

103101
#[test]
104-
#[cfg_attr(not(xet_error_nightly_testing), ignore)]
102+
#[cfg_attr(not(feature = "error_generic_member_access"), ignore)]
105103
fn test_option() {}

0 commit comments

Comments
 (0)