Skip to content
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

Replace \ with std::concat #4

Merged
merged 1 commit into from
Aug 19, 2024
Merged

Replace \ with std::concat #4

merged 1 commit into from
Aug 19, 2024

Conversation

oddcoder
Copy link
Owner

We are normalizing the usage of std::concat execlusively for splitting strings into multiple lines.

We are normalizing the usage of std::concat execlusively for splitting strings into multiple lines.

Signed-off-by: Ahmed Abdelraoof <[email protected]>
@oddcoder oddcoder merged commit 6be62f8 into main Aug 19, 2024
4 checks passed
@trent-reed
Copy link

Huh, I guess you're right that it doesn't matter; this test passes https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=76641f6e256cca381c96290baa88c655

I would have figured it would just escape the line ending, so therefore kept the extra spaces (kinda like this for C: https://gcc.godbolt.org/z/eevTq736h), but apparently it does not in this case (it skips characters until the next non-whitespace, apparently - or something like that).

I'm used to doing this in C:

static const char kConstant[] = "Testing using line "
                                "ending slashes to continue a string.";

Which is why I tend to prefer something similar in format like concat!, but at least it's better defined in rust to do what one would expect. Anyways, I still have a slight preference for concat! for multiline string literals, but it does seem that it's more a matter of preference in rust.

Thanks for doing this!

@oddcoder oddcoder deleted the concat branch August 19, 2024 20:16
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