Starting with some rust!

This commit is contained in:
2026-08-15 15:17:52 +02:00
parent 1b5bf4f8d4
commit 78b05437e4
9 changed files with 60 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
[tools]
rust = { version = "latest", components = ["rust-src", "rust-analyzer", "clippy", "rustfmt"] }
+2
View File
@@ -0,0 +1,2 @@
[tools]
rust = { version = "latest", components = ["rust-src", "rust-analyzer", "clippy", "rustfmt"] }
+7
View File
@@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "wc-tool"
version = "0.1.0"
+6
View File
@@ -0,0 +1,6 @@
[package]
name = "wc-tool"
version = "0.1.0"
edition = "2024"
[dependencies]
+22
View File
@@ -0,0 +1,22 @@
use std::{collections::HashMap, env, fs};
fn main() {
let args: Vec<String> = env::args().collect();
let contents = fs::read_to_string(&args[1]).expect("Something went wrong reading the file.");
let words: Vec<&str> = contents
.split(|c: char| !c.is_alphanumeric())
.filter(|w| !w.is_empty())
.collect();
let mut freq: HashMap<String, u32> = HashMap::new();
for word in words {
let lower = word.to_lowercase();
*freq.entry(lower).or_insert(0) += 1;
}
let mut sorted: Vec<_> = freq.into_iter().collect();
sorted.sort_by(|a, b| b.1.cmp(&a.1));
}
+1
View File
@@ -0,0 +1 @@
{"rustc_fingerprint":15538035603897168445,"outputs":{"13570968475822847137":{"success":true,"status":"","code":0,"stdout":"rustc 1.96.0 (ac68faa20 2026-05-25) (Homebrew)\nbinary: rustc\ncommit-hash: ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96\ncommit-date: 2026-05-25\nhost: aarch64-apple-darwin\nrelease: 1.96.0\nLLVM version: 22.1.6\n","stderr":""},"7971740275564407648":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/opt/homebrew/Cellar/rust/1.96.0\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"aes\"\ntarget_feature=\"crc\"\ntarget_feature=\"dit\"\ntarget_feature=\"dotprod\"\ntarget_feature=\"dpb\"\ntarget_feature=\"dpb2\"\ntarget_feature=\"fcma\"\ntarget_feature=\"fhm\"\ntarget_feature=\"flagm\"\ntarget_feature=\"fp16\"\ntarget_feature=\"frintts\"\ntarget_feature=\"jsconv\"\ntarget_feature=\"lor\"\ntarget_feature=\"lse\"\ntarget_feature=\"neon\"\ntarget_feature=\"paca\"\ntarget_feature=\"pacg\"\ntarget_feature=\"pan\"\ntarget_feature=\"pmuv3\"\ntarget_feature=\"ras\"\ntarget_feature=\"rcpc\"\ntarget_feature=\"rcpc2\"\ntarget_feature=\"rdm\"\ntarget_feature=\"sb\"\ntarget_feature=\"sha2\"\ntarget_feature=\"sha3\"\ntarget_feature=\"ssbs\"\ntarget_feature=\"vh\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""},"6432102384495711296":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.dylib\nlib___.dylib\nlib___.a\nlib___.dylib\n/opt/homebrew/Cellar/rust/1.96.0\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"unix\"\ntarget_feature=\"aes\"\ntarget_feature=\"crc\"\ntarget_feature=\"dit\"\ntarget_feature=\"dotprod\"\ntarget_feature=\"dpb\"\ntarget_feature=\"dpb2\"\ntarget_feature=\"fcma\"\ntarget_feature=\"fhm\"\ntarget_feature=\"flagm\"\ntarget_feature=\"fp16\"\ntarget_feature=\"frintts\"\ntarget_feature=\"jsconv\"\ntarget_feature=\"lor\"\ntarget_feature=\"lse\"\ntarget_feature=\"neon\"\ntarget_feature=\"paca\"\ntarget_feature=\"pacg\"\ntarget_feature=\"pan\"\ntarget_feature=\"pmuv3\"\ntarget_feature=\"ras\"\ntarget_feature=\"rcpc\"\ntarget_feature=\"rcpc2\"\ntarget_feature=\"rdm\"\ntarget_feature=\"sb\"\ntarget_feature=\"sha2\"\ntarget_feature=\"sha3\"\ntarget_feature=\"ssbs\"\ntarget_feature=\"vh\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"macos\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"apple\"\nunix\n","stderr":""}},"successes":{}}
+3
View File
@@ -0,0 +1,3 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir/
+12
View File
@@ -0,0 +1,12 @@
0.136127417s INFO prepare_target{force=false package_id=wc-tool v0.1.0 (/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool) target="wc-tool"}: cargo::core::compiler::fingerprint: stale: changed "/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/src/main.rs"
0.136135458s INFO prepare_target{force=false package_id=wc-tool v0.1.0 (/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool) target="wc-tool"}: cargo::core::compiler::fingerprint: (vs) "/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/target/debug/.fingerprint/wc-tool-af84e2444da36269/dep-bin-wc-tool"
0.136138417s INFO prepare_target{force=false package_id=wc-tool v0.1.0 (/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool) target="wc-tool"}: cargo::core::compiler::fingerprint: FileTime { seconds: 1785684000, nanos: 719746263 } < FileTime { seconds: 1785684358, nanos: 78197815 }
0.137337917s INFO prepare_target{force=false package_id=wc-tool v0.1.0 (/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool) target="wc-tool"}: cargo::core::compiler::fingerprint: fingerprint dirty for wc-tool v0.1.0 (/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool)/Check { test: false }/TargetInner { name: "wc-tool", doc: true, ..: with_path("/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/src/main.rs", Edition2024) }
0.137585625s INFO prepare_target{force=false package_id=wc-tool v0.1.0 (/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool) target="wc-tool"}: cargo::core::compiler::fingerprint: dirty: FsStatusOutdated(StaleItem(ChangedFile { reference: "/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/target/debug/.fingerprint/wc-tool-af84e2444da36269/dep-bin-wc-tool", reference_mtime: FileTime { seconds: 1785684000, nanos: 719746263 }, stale: "/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/src/main.rs", stale_mtime: FileTime { seconds: 1785684358, nanos: 78197815 } }))
0.139030417s INFO prepare_target{force=false package_id=wc-tool v0.1.0 (/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool) target="wc-tool"}: cargo::core::compiler::fingerprint: stale: changed "/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/src/main.rs"
0.139033167s INFO prepare_target{force=false package_id=wc-tool v0.1.0 (/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool) target="wc-tool"}: cargo::core::compiler::fingerprint: (vs) "/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/target/debug/.fingerprint/wc-tool-4009f1fc2d20ccce/dep-test-bin-wc-tool"
0.139035042s INFO prepare_target{force=false package_id=wc-tool v0.1.0 (/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool) target="wc-tool"}: cargo::core::compiler::fingerprint: FileTime { seconds: 1785684000, nanos: 719758096 } < FileTime { seconds: 1785684358, nanos: 78197815 }
0.139274417s INFO prepare_target{force=false package_id=wc-tool v0.1.0 (/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool) target="wc-tool"}: cargo::core::compiler::fingerprint: fingerprint dirty for wc-tool v0.1.0 (/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool)/Check { test: true }/TargetInner { name: "wc-tool", doc: true, ..: with_path("/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/src/main.rs", Edition2024) }
0.139279333s INFO prepare_target{force=false package_id=wc-tool v0.1.0 (/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool) target="wc-tool"}: cargo::core::compiler::fingerprint: dirty: FsStatusOutdated(StaleItem(ChangedFile { reference: "/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/target/debug/.fingerprint/wc-tool-4009f1fc2d20ccce/dep-test-bin-wc-tool", reference_mtime: FileTime { seconds: 1785684000, nanos: 719758096 }, stale: "/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/src/main.rs", stale_mtime: FileTime { seconds: 1785684358, nanos: 78197815 } }))
Checking wc-tool v0.1.0 (/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.39s
+5
View File
@@ -0,0 +1,5 @@
{"reason":"compiler-message","package_id":"path+file:///Users/brianj/src/github/silver-octo-spoon/rust/wc-tool#0.1.0","manifest_path":"/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/Cargo.toml","target":{"kind":["bin"],"crate_types":["bin"],"name":"wc-tool","src_path":"/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/src/main.rs","edition":"2024","doc":true,"doctest":false,"test":true},"message":{"$message_type":"diagnostic","message":"consider using `sort_by_key`","code":{"code":"clippy::unnecessary_sort_by","explanation":null},"level":"warning","spans":[{"file_name":"src/main.rs","byte_start":582,"byte_end":618,"line_start":21,"line_end":21,"column_start":5,"column_end":41,"is_primary":true,"text":[{"text":" sorted.sort_by(|a, b| b.1.cmp(&a.1));","highlight_start":5,"highlight_end":41}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#unnecessary_sort_by","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"`#[warn(clippy::unnecessary_sort_by)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"try","code":null,"level":"help","spans":[{"file_name":"src/main.rs","byte_start":589,"byte_end":618,"line_start":21,"line_end":21,"column_start":12,"column_end":41,"is_primary":true,"text":[{"text":" sorted.sort_by(|a, b| b.1.cmp(&a.1));","highlight_start":12,"highlight_end":41}],"label":null,"suggested_replacement":"sort_by_key(|b| std::cmp::Reverse(b.1))","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: consider using `sort_by_key`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/main.rs:21:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m21\u001b[0m \u001b[1m\u001b[94m|\u001b[0m sorted.sort_by(|a, b| b.1.cmp(&a.1));\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mhelp\u001b[0m: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#unnecessary_sort_by\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(clippy::unnecessary_sort_by)]` on by default\n\u001b[1m\u001b[96mhelp\u001b[0m: try\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m21\u001b[0m \u001b[91m- \u001b[0m sorted.\u001b[91msort_by(|a, b| b.1.cmp(&a.1))\u001b[0m;\n\u001b[1m\u001b[94m21\u001b[0m \u001b[92m+ \u001b[0m sorted.\u001b[92msort_by_key(|b| std::cmp::Reverse(b.1))\u001b[0m;\n \u001b[1m\u001b[94m|\u001b[0m\n\n"}}
{"reason":"compiler-message","package_id":"path+file:///Users/brianj/src/github/silver-octo-spoon/rust/wc-tool#0.1.0","manifest_path":"/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/Cargo.toml","target":{"kind":["bin"],"crate_types":["bin"],"name":"wc-tool","src_path":"/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/src/main.rs","edition":"2024","doc":true,"doctest":false,"test":true},"message":{"$message_type":"diagnostic","message":"consider using `sort_by_key`","code":{"code":"clippy::unnecessary_sort_by","explanation":null},"level":"warning","spans":[{"file_name":"src/main.rs","byte_start":582,"byte_end":618,"line_start":21,"line_end":21,"column_start":5,"column_end":41,"is_primary":true,"text":[{"text":" sorted.sort_by(|a, b| b.1.cmp(&a.1));","highlight_start":5,"highlight_end":41}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#unnecessary_sort_by","code":null,"level":"help","spans":[],"children":[],"rendered":null},{"message":"`#[warn(clippy::unnecessary_sort_by)]` on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null},{"message":"try","code":null,"level":"help","spans":[{"file_name":"src/main.rs","byte_start":589,"byte_end":618,"line_start":21,"line_end":21,"column_start":12,"column_end":41,"is_primary":true,"text":[{"text":" sorted.sort_by(|a, b| b.1.cmp(&a.1));","highlight_start":12,"highlight_end":41}],"label":null,"suggested_replacement":"sort_by_key(|b| std::cmp::Reverse(b.1))","suggestion_applicability":"MaybeIncorrect","expansion":null}],"children":[],"rendered":null}],"rendered":"\u001b[1m\u001b[33mwarning\u001b[0m\u001b[1m: consider using `sort_by_key`\u001b[0m\n \u001b[1m\u001b[94m--> \u001b[0msrc/main.rs:21:5\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m21\u001b[0m \u001b[1m\u001b[94m|\u001b[0m sorted.sort_by(|a, b| b.1.cmp(&a.1));\n \u001b[1m\u001b[94m|\u001b[0m \u001b[1m\u001b[33m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\n \u001b[1m\u001b[94m|\u001b[0m\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mhelp\u001b[0m: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#unnecessary_sort_by\n \u001b[1m\u001b[94m= \u001b[0m\u001b[1mnote\u001b[0m: `#[warn(clippy::unnecessary_sort_by)]` on by default\n\u001b[1m\u001b[96mhelp\u001b[0m: try\n \u001b[1m\u001b[94m|\u001b[0m\n\u001b[1m\u001b[94m21\u001b[0m \u001b[91m- \u001b[0m sorted.\u001b[91msort_by(|a, b| b.1.cmp(&a.1))\u001b[0m;\n\u001b[1m\u001b[94m21\u001b[0m \u001b[92m+ \u001b[0m sorted.\u001b[92msort_by_key(|b| std::cmp::Reverse(b.1))\u001b[0m;\n \u001b[1m\u001b[94m|\u001b[0m\n\n"}}
{"reason":"compiler-artifact","package_id":"path+file:///Users/brianj/src/github/silver-octo-spoon/rust/wc-tool#0.1.0","manifest_path":"/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/Cargo.toml","target":{"kind":["bin"],"crate_types":["bin"],"name":"wc-tool","src_path":"/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/src/main.rs","edition":"2024","doc":true,"doctest":false,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/target/debug/deps/libwc_tool-af84e2444da36269.rmeta"],"executable":null,"fresh":false}
{"reason":"compiler-artifact","package_id":"path+file:///Users/brianj/src/github/silver-octo-spoon/rust/wc-tool#0.1.0","manifest_path":"/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/Cargo.toml","target":{"kind":["bin"],"crate_types":["bin"],"name":"wc-tool","src_path":"/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/src/main.rs","edition":"2024","doc":true,"doctest":false,"test":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":true},"features":[],"filenames":["/Users/brianj/src/github/silver-octo-spoon/rust/wc-tool/target/debug/deps/libwc_tool-4009f1fc2d20ccce.rmeta"],"executable":null,"fresh":false}
{"reason":"build-finished","success":true}