Skip to content

Commit e317178

Browse files
LessUpqwencoder
andcommitted
fix: 修复CI工作流中的Rust格式化和文档构建错误
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
1 parent 488b090 commit e317178

5 files changed

Lines changed: 21 additions & 7 deletions

File tree

arithmetic/rust/main.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ impl<W: Write> ArithmeticEncoder<W> {
121121
fn encode_symbol(&mut self, symbol: u32, cumulative: &[u32]) -> io::Result<()> {
122122
let range = self.high - self.low + 1;
123123
let total = *cumulative.last().ok_or_else(|| {
124-
io::Error::new(io::ErrorKind::InvalidData, "empty cumulative frequency table")
124+
io::Error::new(
125+
io::ErrorKind::InvalidData,
126+
"empty cumulative frequency table",
127+
)
125128
})? as u64;
126129
let sym_low = cumulative[symbol as usize] as u64;
127130
let sym_high = cumulative[symbol as usize + 1] as u64;
@@ -198,7 +201,10 @@ impl<R: Read> ArithmeticDecoder<R> {
198201
fn decode_symbol(&mut self, cumulative: &[u32]) -> io::Result<u32> {
199202
let range = self.high - self.low + 1;
200203
let total = *cumulative.last().ok_or_else(|| {
201-
io::Error::new(io::ErrorKind::InvalidData, "empty cumulative frequency table")
204+
io::Error::new(
205+
io::ErrorKind::InvalidData,
206+
"empty cumulative frequency table",
207+
)
202208
})? as u64;
203209
let offset = self.code - self.low;
204210
let value = ((offset + 1) * total - 1) / range;
@@ -284,8 +290,12 @@ fn scale_frequencies(freq: &mut [u32]) {
284290

285291
fn build_frequencies_from_file(path: &str) -> io::Result<Vec<u32>> {
286292
let mut freq = vec![0u32; SYMBOL_LIMIT];
287-
let file = File::open(path)
288-
.map_err(|e| io::Error::new(e.kind(), format!("cannot open input file for reading: {path}: {e}")))?;
293+
let file = File::open(path).map_err(|e| {
294+
io::Error::new(
295+
e.kind(),
296+
format!("cannot open input file for reading: {path}: {e}"),
297+
)
298+
})?;
289299

290300
// Check file size to prevent frequency overflow
291301
let metadata = file.metadata()?;
@@ -353,9 +363,9 @@ fn read_frequencies<R: Read>(reader: &mut R) -> io::Result<Vec<u32>> {
353363
let mut freq = vec![0u32; count];
354364
for f in freq.iter_mut() {
355365
let mut arr = [0u8; 4];
356-
reader
357-
.read_exact(&mut arr)
358-
.map_err(|e| io::Error::new(e.kind(), format!("failed to read frequency table: {e}")))?;
366+
reader.read_exact(&mut arr).map_err(|e| {
367+
io::Error::new(e.kind(), format!("failed to read frequency table: {e}"))
368+
})?;
359369
*f = u32::from_le_bytes(arr);
360370
}
361371
Ok(freq)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* Animation styles */
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* Component styles */
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* Custom styles */
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* Custom CSS variables for VitePress theme */

0 commit comments

Comments
 (0)