Skip to content

Commit 18cbd19

Browse files
committed
fmt && clippy
1 parent d605e59 commit 18cbd19

File tree

7 files changed

+18
-15
lines changed

7 files changed

+18
-15
lines changed

ceno_host/tests/test_elf.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ fn test_bubble_sorting() -> Result<()> {
139139
CENO_PLATFORM.clone(),
140140
ceno_examples::quadratic_sorting,
141141
// Provide some random numbers to sort.
142-
CenoStdin::default()
143-
.write(&(0..1_000).map(|_| rng.next_u32()).collect::<Vec<_>>())?,
142+
CenoStdin::default().write(&(0..1_000).map(|_| rng.next_u32()).collect::<Vec<_>>())?,
144143
None,
145144
));
146145
for msg in &all_messages {
@@ -155,8 +154,7 @@ fn test_sorting() -> Result<()> {
155154
CENO_PLATFORM.clone(),
156155
ceno_examples::sorting,
157156
// Provide some random numbers to sort.
158-
CenoStdin::default()
159-
.write(&(0..1000).map(|_| rng.next_u32()).collect::<Vec<_>>())?,
157+
CenoStdin::default().write(&(0..1000).map(|_| rng.next_u32()).collect::<Vec<_>>())?,
160158
None,
161159
));
162160
for (i, msg) in enumerate(&all_messages) {

ceno_rt/src/mmio.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ static PUBIO_STATE: RegionStateCell = RegionStateCell::new();
8181

8282
pub fn read_slice<'a>() -> &'a [u8] {
8383
unsafe {
84-
HINT_STATE.with_mut(|state| state.take_slice(&raw const _lengths_of_hints_start, &_hints_start))
84+
HINT_STATE
85+
.with_mut(|state| state.take_slice(&raw const _lengths_of_hints_start, &_hints_start))
8586
}
8687
}
8788

@@ -101,7 +102,8 @@ where
101102

102103
pub fn pubio_read_slice<'a>() -> &'a [u8] {
103104
unsafe {
104-
PUBIO_STATE.with_mut(|state| state.take_slice(&raw const _lengths_of_pubio_start, &_pubio_start))
105+
PUBIO_STATE
106+
.with_mut(|state| state.take_slice(&raw const _lengths_of_pubio_start, &_pubio_start))
105107
}
106108
}
107109

ceno_serde/src/deserializer.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ use alloc::{string::String, vec, vec::Vec};
33
use bytemuck::Pod;
44
use serde::de::{DeserializeOwned, DeserializeSeed, IntoDeserializer, Visitor};
55

6-
use crate::{align_up, err::{Error, Result}, WORD_SIZE};
6+
use crate::{
7+
WORD_SIZE, align_up,
8+
err::{Error, Result},
9+
};
710

811
/// A reader for reading streams with serialized word-based data
912
pub trait WordRead {

ceno_serde/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ mod deserializer;
88
mod err;
99
mod serializer;
1010

11-
pub use deserializer::{from_slice, Deserializer, WordRead};
11+
pub use deserializer::{Deserializer, WordRead, from_slice};
1212
pub use err::{Error, Result};
13-
pub use serializer::{to_vec, to_vec_with_capacity, Serializer, WordWrite};
13+
pub use serializer::{Serializer, WordWrite, to_vec, to_vec_with_capacity};
1414

1515
pub(crate) const WORD_SIZE: usize = 4;
1616

ceno_serde/src/serializer.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
use alloc::{string::ToString, vec::Vec};
22

3-
use crate::{err::{Error, Result}, WORD_SIZE};
3+
use crate::{
4+
WORD_SIZE,
5+
err::{Error, Result},
6+
};
47

58
/// A writer for writing streams preferring word-based data.
69
pub trait WordWrite {

examples/examples/hints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
extern crate alloc;
22
extern crate ceno_rt;
3-
use alloc::string::String;
43
use ceno_rt::debug_println;
54
#[cfg(debug_assertions)]
65
use core::fmt::Write;
@@ -10,6 +9,7 @@ fn main() {
109
assert!(condition);
1110
#[cfg(debug_assertions)]
1211
{
12+
use alloc::string::String;
1313
let msg: String = ceno_rt::read();
1414
debug_println!("This message is a hint: {msg}");
1515
}

examples/examples/keccak_no_syscall.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ use tiny_keccak::{Hasher, Keccak};
33
pub fn main() {
44
let times = 100;
55
let raw_preimage: Vec<u32> = ceno_rt::read();
6-
let preimage: Vec<u8> = raw_preimage
7-
.iter()
8-
.flat_map(|x| x.to_le_bytes())
9-
.collect();
6+
let preimage: Vec<u8> = raw_preimage.iter().flat_map(|x| x.to_le_bytes()).collect();
107
for i in 0..times {
118
let digest = keccak256(&preimage)
129
.chunks_exact(4)

0 commit comments

Comments
 (0)