From 3d45164562a3dc1d9e2e1a35333d70e78a30e484 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Tue, 11 Feb 2025 23:35:05 +0300 Subject: [PATCH] Increase max with to 120 --- .cargo/config.toml | 2 +- .rustfmt.toml | 37 +++++++++++++++++++------------------ Cargo.toml | 2 +- embd-macros/Cargo.toml | 26 +++++++++++++------------- embd-macros/src/lib.rs | 9 ++------- embd/Cargo.toml | 20 ++++++++++---------- embd/src/lib.rs | 15 +++------------ 7 files changed, 49 insertions(+), 62 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index ed1e141..d3992b5 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,2 @@ [build] -rustflags = [ "--cfg", "procmacro2_semver_exempt" ] +rustflags = ["--cfg", "procmacro2_semver_exempt"] diff --git a/.rustfmt.toml b/.rustfmt.toml index 02d5415..8864d7d 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -1,19 +1,20 @@ -condense_wildcard_suffixes = true +condense_wildcard_suffixes = true +max_width = 120 enum_discrim_align_threshold = 25 -force_explicit_abi = false -force_multiline_blocks = true -format_code_in_doc_comments = true -format_macro_matchers = true -format_strings = true -group_imports = "StdExternalCrate" -hex_literal_case = "Upper" -imports_granularity = "Crate" -imports_layout = "Vertical" -match_block_trailing_comma = true -newline_style = "Unix" -normalize_comments = true -normalize_doc_attributes = true -reorder_impl_items = true -unstable_features = true -use_try_shorthand = true -wrap_comments = true +force_explicit_abi = false +force_multiline_blocks = true +format_code_in_doc_comments = true +format_macro_matchers = true +format_strings = true +group_imports = "StdExternalCrate" +hex_literal_case = "Upper" +imports_granularity = "Crate" +imports_layout = "Vertical" +match_block_trailing_comma = true +newline_style = "Unix" +normalize_comments = true +normalize_doc_attributes = true +reorder_impl_items = true +unstable_features = true +use_try_shorthand = true +wrap_comments = true diff --git a/Cargo.toml b/Cargo.toml index fe651cc..64d0b7a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,3 @@ [workspace] -members = [ "embd", "embd-macros" ] +members = ["embd", "embd-macros"] resolver = "2" diff --git a/embd-macros/Cargo.toml b/embd-macros/Cargo.toml index 6c2676c..185a8e4 100644 --- a/embd-macros/Cargo.toml +++ b/embd-macros/Cargo.toml @@ -1,22 +1,22 @@ [package] -name = "embd-macros" +name = "embd-macros" description = "Read files or directories from the filesystem at runtime on debug, embed on release." -repository = "https://github.com/RGBCube/embd-rs" -license = "MIT" -keywords = [ "embedding", "files", "debug-optimization", "bundling" ] -categories = [ "filesystem" ] -authors = [ "RGBCube" ] -version = "0.1.5" -edition = "2021" -include = [ "src/**/*.rs", "../README.md" ] +repository = "https://github.com/RGBCube/embd-rs" +license = "MIT" +keywords = ["embedding", "files", "debug-optimization", "bundling"] +categories = ["filesystem"] +authors = ["RGBCube"] +version = "0.1.5" +edition = "2021" +include = ["src/**/*.rs", "../README.md"] [package.metadata.docs.rs] -rustc-args = [ "--cfg", "procmacro2_semver_exempt" ] +rustc-args = ["--cfg", "procmacro2_semver_exempt"] [lib] proc-macro = true [dependencies] -proc-macro2 = { version = "1", features = [ "span-locations" ] } -quote = "1" -syn = "2" +proc-macro2 = { version = "1", features = ["span-locations"] } +quote = "1" +syn = "2" diff --git a/embd-macros/src/lib.rs b/embd-macros/src/lib.rs index d78b135..e1408a6 100644 --- a/embd-macros/src/lib.rs +++ b/embd-macros/src/lib.rs @@ -78,10 +78,7 @@ fn dir_release(input: TokenStream, path: &str) -> TokenStream { let base = neighbor.parent().expect("Failed to get the parent of file"); - let directory = base - .join(path) - .canonicalize() - .expect("Failed to canonicalize path"); + let directory = base.join(path).canonicalize().expect("Failed to canonicalize path"); let directory_str = directory.to_str().expect("Failed to convert OsStr to str"); @@ -108,9 +105,7 @@ fn read_dir(directory: &Path) -> TokenVec { .to_str() .expect("Failed to get the string representation of PathBuf"); - let filetype = fs::metadata(&path) - .expect("Failed to get file metadata") - .file_type(); + let filetype = fs::metadata(&path).expect("Failed to get file metadata").file_type(); if filetype.is_dir() { let children = read_dir(&path); diff --git a/embd/Cargo.toml b/embd/Cargo.toml index 86d5a68..27aa938 100644 --- a/embd/Cargo.toml +++ b/embd/Cargo.toml @@ -1,17 +1,17 @@ [package] -name = "embd" +name = "embd" description = "Read files or directories from the filesystem at runtime on debug, embed on release." -repository = "https://github.com/RGBCube/embd-rs" -license = "MIT" -keywords = [ "embedding", "files", "debug-optimization", "bundling" ] -categories = [ "filesystem" ] -authors = [ "RGBCube" ] -version = "0.1.5" -edition = "2021" -include = [ "src/**/*.rs", "../README.md" ] +repository = "https://github.com/RGBCube/embd-rs" +license = "MIT" +keywords = ["embedding", "files", "debug-optimization", "bundling"] +categories = ["filesystem"] +authors = ["RGBCube"] +version = "0.1.5" +edition = "2021" +include = ["src/**/*.rs", "../README.md"] [package.metadata.docs.rs] -rustc-args = [ "--cfg", "procmacro2_semver_exempt" ] +rustc-args = ["--cfg", "procmacro2_semver_exempt"] [dependencies] embd-macros = "0.1" diff --git a/embd/src/lib.rs b/embd/src/lib.rs index 326a1d5..10c7d92 100644 --- a/embd/src/lib.rs +++ b/embd/src/lib.rs @@ -171,15 +171,9 @@ fn read_dir(directory: &Path) -> Vec { let filetype = entry.file_type().expect("Failed to read entry filetype"); - let path = entry - .path() - .canonicalize() - .expect("Failed to canonicalize path"); + let path = entry.path().canonicalize().expect("Failed to canonicalize path"); - let path_str = path - .to_str() - .expect("Failed to convert OsStr to str") - .to_string(); + let path_str = path.to_str().expect("Failed to convert OsStr to str").to_string(); if filetype.is_dir() { let children = read_dir(&path); @@ -210,10 +204,7 @@ pub fn __dir_runtime(neighbor: &str, path: &str) -> Dir { .canonicalize() .expect("Failed to canonicalize path"); - let directory_str = directory - .to_str() - .expect("Failed to convert OsStr to str") - .to_string(); + let directory_str = directory.to_str().expect("Failed to convert OsStr to str").to_string(); let children = read_dir(&directory);