Skip to content

Commit

Permalink
fix: formatting in tokio-util/ and tokio/src/
Browse files Browse the repository at this point in the history
  • Loading branch information
hamirmahal committed Nov 16, 2024
1 parent 5f1e393 commit 4efe517
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 32 deletions.
6 changes: 1 addition & 5 deletions tokio-util/src/time/wheel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,7 @@ mod test {
#[test]
fn test_level_for() {
for pos in 0..64 {
assert_eq!(
0,
level_for(0, pos),
"level_for({pos}) -- binary = {pos:b}"
);
assert_eq!(0, level_for(0, pos), "level_for({pos}) -- binary = {pos:b}");
}

for level in 1..5 {
Expand Down
20 changes: 4 additions & 16 deletions tokio-util/tests/codecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,26 +75,17 @@ fn lines_decoder_max_length() {
assert!(codec.decode(buf).is_err());

let line = codec.decode(buf).unwrap().unwrap();
assert!(
line.len() <= MAX_LENGTH,
"{line:?}.len() <= {MAX_LENGTH:?}"
);
assert!(line.len() <= MAX_LENGTH, "{line:?}.len() <= {MAX_LENGTH:?}");
assert_eq!("line 2", line);

assert!(codec.decode(buf).is_err());

let line = codec.decode(buf).unwrap().unwrap();
assert!(
line.len() <= MAX_LENGTH,
"{line:?}.len() <= {MAX_LENGTH:?}"
);
assert!(line.len() <= MAX_LENGTH, "{line:?}.len() <= {MAX_LENGTH:?}");
assert_eq!("line 4", line);

let line = codec.decode(buf).unwrap().unwrap();
assert!(
line.len() <= MAX_LENGTH,
"{line:?}.len() <= {MAX_LENGTH:?}"
);
assert!(line.len() <= MAX_LENGTH, "{line:?}.len() <= {MAX_LENGTH:?}");
assert_eq!("", line);

assert_eq!(None, codec.decode(buf).unwrap());
Expand All @@ -103,10 +94,7 @@ fn lines_decoder_max_length() {
assert_eq!(None, codec.decode(buf).unwrap());

let line = codec.decode_eof(buf).unwrap().unwrap();
assert!(
line.len() <= MAX_LENGTH,
"{line:?}.len() <= {MAX_LENGTH:?}"
);
assert!(line.len() <= MAX_LENGTH, "{line:?}.len() <= {MAX_LENGTH:?}");
assert_eq!("\rk", line);

assert_eq!(None, codec.decode(buf).unwrap());
Expand Down
8 changes: 2 additions & 6 deletions tokio/src/loom/std/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ pub(crate) mod sys {
match std::env::var(ENV_WORKER_THREADS) {
Ok(s) => {
let n = s.parse().unwrap_or_else(|e| {
panic!(
"\"{ENV_WORKER_THREADS}\" must be usize, error: {e}, value: {s}"
)
panic!("\"{ENV_WORKER_THREADS}\" must be usize, error: {e}, value: {s}")
});
assert!(n > 0, "\"{ENV_WORKER_THREADS}\" cannot be set to 0");
n
Expand All @@ -106,9 +104,7 @@ pub(crate) mod sys {
std::thread::available_parallelism().map_or(1, NonZeroUsize::get)
}
Err(std::env::VarError::NotUnicode(e)) => {
panic!(
"\"{ENV_WORKER_THREADS}\" must be valid unicode, error: {e:?}"
)
panic!("\"{ENV_WORKER_THREADS}\" must be valid unicode, error: {e:?}")
}
}
}
Expand Down
6 changes: 1 addition & 5 deletions tokio/src/runtime/time/wheel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,7 @@ mod test {
#[test]
fn test_level_for() {
for pos in 0..64 {
assert_eq!(
0,
level_for(0, pos),
"level_for({pos}) -- binary = {pos:b}"
);
assert_eq!(0, level_for(0, pos), "level_for({pos}) -- binary = {pos:b}");
}

for level in 1..5 {
Expand Down

0 comments on commit 4efe517

Please sign in to comment.