format comment

This commit is contained in:
houseme
2025-05-27 13:56:19 +08:00
parent 7abcfe31e8
commit ca8f399832
27 changed files with 204 additions and 211 deletions
+2 -2
View File
@@ -15,8 +15,8 @@ pub const VERSION: &str = "0.0.1";
pub const DEFAULT_LOG_LEVEL: &str = "info";
/// Default configuration use stdout
/// Default value: true
pub const USE_STDOUT: bool = true;
/// Default value: false
pub const USE_STDOUT: bool = false;
/// Default configuration sample ratio
/// Default value: 1.0
+5 -5
View File
@@ -286,10 +286,10 @@ mod tests {
use std::mem;
let size = mem::size_of::<Error>();
// 错误类型应该相对紧凑,考虑到包含多种错误类型,96字节是合理的
// 错误类型应该相对紧凑,考虑到包含多种错误类型,96 字节是合理的
assert!(size <= 128, "Error size should be reasonable, got {} bytes", size);
// 测试Option<Error>的大小
// 测试 Option<Error>的大小
let option_size = mem::size_of::<Option<Error>>();
assert!(option_size <= 136, "Option<Error> should be efficient, got {} bytes", option_size);
}
@@ -321,7 +321,7 @@ mod tests {
_ => panic!("Expected Custom error variant"),
}
// 测试包含Unicode字符的消息
// 测试包含 Unicode 字符的消息
let unicode_error = Error::custom("🚀 Unicode test 测试 🎉");
match unicode_error {
Error::Custom(msg) => assert!(msg.contains('🚀')),
@@ -405,11 +405,11 @@ mod tests {
let display_str = error.to_string();
let debug_str = format!("{:?}", error);
// DisplayDebug都不应该为空
// DisplayDebug 都不应该为空
assert!(!display_str.is_empty());
assert!(!debug_str.is_empty());
// Debug输出通常包含更多信息,但不是绝对的
// Debug 输出通常包含更多信息,但不是绝对的
// 这里我们只验证两者都有内容即可
assert!(debug_str.len() > 0);
assert!(display_str.len() > 0);
+6 -6
View File
@@ -716,7 +716,7 @@ mod tests {
#[test]
fn test_compression_format_clone_and_copy() {
// 测试CompressionFormat是否可以被复制
// 测试 CompressionFormat 是否可以被复制
let format = CompressionFormat::Gzip;
let format_copy = format;
@@ -729,7 +729,7 @@ mod tests {
#[test]
fn test_compression_format_match_exhaustiveness() {
// 测试match语句的完整性
// 测试 match 语句的完整性
fn handle_format(format: CompressionFormat) -> &'static str {
match format {
CompressionFormat::Gzip => "gzip",
@@ -906,7 +906,7 @@ mod tests {
#[test]
fn test_zip_entry_creation() {
// 测试ZIP条目信息创建
// 测试 ZIP 条目信息创建
let entry = ZipEntry {
name: "test.txt".to_string(),
size: 1024,
@@ -934,7 +934,7 @@ mod tests {
];
for level in levels {
// 验证每个级别都有对应的Debug实现
// 验证每个级别都有对应的 Debug 实现
let _debug_str = format!("{:?}", level);
}
}
@@ -960,7 +960,7 @@ mod tests {
// 验证支持状态检查
let _supported = format.is_supported();
// 验证Debug实现
// 验证 Debug 实现
let _debug = format!("{:?}", format);
}
}
@@ -991,7 +991,7 @@ mod tests {
// .await
// {
// Ok(_) => println!("解压成功!"),
// Err(e) => println!("解压失败: {}", e),
// Err(e) => println!("解压失败{}", e),
// }
// Ok(())