Skip to content

Commit

Permalink
Merge pull request #44 from thenatx/main
Browse files Browse the repository at this point in the history
chore: Delete unnecesary mutable variable when create COMMENT_TEMPLATES static
  • Loading branch information
SergioRibera authored Nov 18, 2024
2 parents 1281066 + 8729131 commit eea3570
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 45 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ anyhow = "1.0.66"
axum = "0.7.5"
chrono = "0.4.38"
color-eyre = "0.6.2"
lazy_static = "1.4.0"
parking_lot = { version = "0.12", features = ["send_guard"] }
poise = "0.6.1"
reqwest = { version = "0.11.27", features = ["json"] } # Version used by songbird::input::YoutubeDl
Expand Down
83 changes: 39 additions & 44 deletions src/bot/events/read_github_links.rs
Original file line number Diff line number Diff line change
@@ -1,53 +1,48 @@
use lazy_static::lazy_static;
use poise::serenity_prelude::{Context, CreateMessage, Message, MESSAGE_CODE_LIMIT};
use regex::{Captures, Regex};
use reqwest::get;
use std::collections::{HashMap, HashSet};
use std::option::Option;

lazy_static! {
static ref COMMENT_TEMPLATES: HashMap<&'static str, &'static str> = {
let mut m = HashMap::new();
m.insert("c", "// {}");
m.insert("cpp", "// {}");
m.insert("cs", "// {}");
m.insert("java", "// {}");
m.insert("js", "// {}");
m.insert("go", "// {}");
m.insert("kt", "// {}");
m.insert("swift", "// {}");
m.insert("rs", "// {}");
m.insert("scala", "// {}");
m.insert("py", "# {}");
m.insert("sh", "# {}");
m.insert("pl", "# {}");
m.insert("rb", "# {}");
m.insert("r", "# {}");
m.insert("ps1", "# {}");
m.insert("php", "// {}");
m.insert("sql", "-- {}");
m.insert("html", "<!-- {} -->");
m.insert("xml", "<!-- {} -->");
m.insert("css", "/* {} */");
m.insert("lisp", "; {}");
m.insert("scm", "; {}");
m.insert("hs", "-- {}");
m.insert("m", "% {}");
m.insert("asm", "; {}");
m.insert("pro", "% {}");
m.insert("vim", "\" {}");
m.insert("ini", "; {}");
m.insert("jl", "# {}");
m.insert("erl", "% {}");
m.insert("ex", "# {}");
m.insert("lua", "-- {}");
m.insert("tcl", "# {}");
m.insert("yml", "# {}");
m.insert("md", "[comment]: # ({})");
m.insert("lhs", "-- {}");
m
};
}
static COMMENT_TEMPLATES: HashMap<&'static str, &'static str> = HashMap::from([
("c", "// {}"),
("cpp", "// {}"),
("cs", "// {}"),
("java", "// {}"),
("js", "// {}"),
("go", "// {}"),
("kt", "// {}"),
("swift", "// {}"),
("rs", "// {}"),
("scala", "// {}"),
("py", "# {}"),
("sh", "# {}"),
("pl", "# {}"),
("rb", "# {}"),
("r", "# {}"),
("ps1", "# {}"),
("php", "// {}"),
("sql", "-- {}"),
("html", "<!-- {} -->"),
("xml", "<!-- {} -->"),
("css", "/* {} */"),
("lisp", "; {}"),
("scm", "; {}"),
("hs", "-- {}"),
("m", "% {}"),
("asm", "; {}"),
("pro", "% {}"),
("vim", "\" {}"),
("ini", "; {}"),
("jl", "# {}"),
("erl", "% {}"),
("ex", "# {}"),
("lua", "-- {}"),
("tcl", "# {}"),
("yml", "# {}"),
("md", "[comment]: # ({})"),
("lhs", "-- {}"),
]);

pub enum RangeOrIndex {
Language(String),
Expand Down

0 comments on commit eea3570

Please sign in to comment.