8000 fix: replace regex with string operations by brkicdusan · Pull Request #12 · coltiebaby/league-client · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: replace regex with string operations #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 21, 2024

Conversation

brkicdusan
Copy link
Contributor

Resolves #11

Copy link
Owner
@coltiebaby coltiebaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the most part. Just wanna avoid having a runtime error happen if we get by index here.

src/client.rs Outdated

for arg in args {
if arg.starts_with("--remoting-auth-token") {
let val = arg.split("=").collect::<Vec<&str>>()[1];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mind getting rid of the index here?

let val = arg.split("=").collect::<Vec<&str>>().first();
let token = val.ok_or(Error::AppNotRunning);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'll change it no problem, though if I understand how args work it should always split into exactly 2 parts so this should still be fine I think.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're probably right. This is just the only thing that's bitten us at work lately so i try to avoid it as much as possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I changed it, it looks cleaner without indexing, plus it avoids needing to make a vector. I'm kind of new to rust still so I overcomplicate stuff like this a lot.

src/client.rs Outdated
token = Ok(val);
}
if arg.starts_with("--app-port") {
let val = arg.split("=").collect::<Vec<&str>>()[1];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

@brkicdusan brkicdusan requested a review from coltiebaby October 21, 2024 18:47
@coltiebaby
Copy link
Owner

Cool thanks!

@coltiebaby coltiebaby merged commit 0d04fb8 into coltiebaby:main Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when connecting to the client
2 participants
0