Skip to content

Commit 715a84c

Browse files
committed
Tokenize strings on split
1 parent b68ac41 commit 715a84c

File tree

9 files changed

+9
-9
lines changed

9 files changed

+9
-9
lines changed

src/discord_bot/chess.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ pub(crate) async fn run(
504504
if args.is_empty() {
505505
return print_usage(guild_id, ctx, message).await;
506506
}
507-
let args: Vec<&str> = args.split(' ').collect();
507+
let args: Vec<&str> = args.split_whitespace().collect();
508508

509509
match args[0] {
510510
"start" => {

src/discord_bot/counter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub(crate) async fn run(
3838
ctx: Context,
3939
message: &Message,
4040
) -> crate::Result<()> {
41-
let mut args = args.split(' ');
41+
let mut args = args.split_whitespace();
4242
match args.next() {
4343
Some("list") => list_counters(guild_id, ctx, message).await?,
4444
Some("add") => add_counter(guild_id, ctx, message, args).await?,

src/discord_bot/permanent_latest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub(crate) async fn on_configure_command(
8080
if args.is_empty() {
8181
return print_usage(guild_id, ctx, message).await;
8282
}
83-
let args: Vec<_> = args.split(' ').collect();
83+
let args: Vec<_> = args.split_whitespace().collect();
8484

8585
match args[0] {
8686
"add" => {

src/discord_bot/reaction_role_toggle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub(crate) async fn run(
1616
return Ok(());
1717
}
1818

19-
let args: Vec<_> = args.split(' ').collect();
19+
let args: Vec<_> = args.split_whitespace().collect();
2020
if args.len() != 5 {
2121
return print_usage(guild_id, ctx, message).await;
2222
}

src/discord_bot/role.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub(crate) async fn run(
3636
ctx: Context,
3737
message: &Message,
3838
) -> crate::Result<()> {
39-
let args: Vec<_> = args.split(' ').collect();
39+
let args: Vec<_> = args.split_whitespace().collect();
4040
match args[0] {
4141
"add" => {
4242
if args.len() != 3 {

src/discord_bot/roletoggle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub(crate) async fn run(
1818
return Ok(());
1919
}
2020

21-
let args: Vec<_> = args.split(' ').collect();
21+
let args: Vec<_> = args.split_whitespace().collect();
2222
match args[0] {
2323
"add" => {
2424
if !(3..=4).contains(&args.len()) {

src/discord_bot/social_credit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub(crate) async fn run(
99
ctx: Context,
1010
message: &Message,
1111
) -> crate::Result<()> {
12-
let args = args.split(' ').collect::<Vec<_>>();
12+
let args = args.split_whitespace().collect::<Vec<_>>();
1313
if args.is_empty() {
1414
print_usage(guild_id, ctx, message).await?;
1515
return Ok(());

src/pterodactyl/smp_commands.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ async fn handle_chat_message(
7474
if let Some(command) = message.strip_prefix('!') {
7575
if server.allow_commands {
7676
info!("Received command {} from {}", command, sender);
77-
let args: Vec<_> = command.split(' ').collect();
77+
let args: Vec<_> = command.split_whitespace().collect();
7878
match args[0] {
7979
"s" => {
8080
if args.len() > 1 {

src/stdin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub(crate) fn handle_stdin_loop(runtime: &tokio::runtime::Runtime, data: Protobo
1717
if let Some(slash_removed) = line.strip_prefix('/') {
1818
line = slash_removed;
1919
}
20-
if let Err(err) = handle_command(&data, line.split(' ')).await {
20+
if let Err(err) = handle_command(&data, line.split_whitespace()).await {
2121
error!("Error while handling stdin: {}", err);
2222
}
2323
});

0 commit comments

Comments
 (0)