Skip to content

refactor: replace format! with concat! for string literals#709

Merged
PsypherPunk merged 2 commits into
bee-san:masterfrom
Integral-Tech:replace-format
Dec 8, 2024
Merged

refactor: replace format! with concat! for string literals#709
PsypherPunk merged 2 commits into
bee-san:masterfrom
Integral-Tech:replace-format

Conversation

@Integral-Tech
Copy link
Copy Markdown
Contributor

@Integral-Tech Integral-Tech commented Dec 2, 2024

  • format! macro introduces overhead of creating a new String object during runtime. On the contrary, concat! macro constructs &str during compilation, which is more efficient.

Comment thread src/main.rs Outdated
Copy link
Copy Markdown
Collaborator

@PsypherPunk PsypherPunk left a comment

Choose a reason for hiding this comment

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

LGTM. I think this gives a clearer representation of what the output's supposed to look like in the code.

Output from running locally:

❯ ./target/debug/rustscan --addresses 127.0.0.1 --ports 443
.----. .-. .-. .----..---.  .----. .---.   .--.  .-. .-.
| {}  }| { } |{ {__ {_   _}{ {__  /  ___} / {} \ |  `| |
| .-. \| {_} |.-._} } | |  .-._} }\     }/  /\  \| |\  |
`-' `-'`-----'`----'  `-'  `----'  `---' `-'  `-'`-' `-'
The Modern Day Port Scanner.

@PsypherPunk PsypherPunk merged commit 6a25fb1 into bee-san:master Dec 8, 2024
@Integral-Tech Integral-Tech deleted the replace-format branch December 8, 2024 14:41
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.

2 participants