Skip to content

Conversation

MaikKlein
Copy link
Contributor

You can now do:

~"a" * 10 // ~"aaaaaaaaaa"

@MaikKlein
Copy link
Contributor Author

making use of .repeat now

@huonw
Copy link
Contributor

huonw commented Jul 21, 2013

This should implement it on &'self str and @str as well, no need to force 2 allocations for "abc" * 100. (You could even squash the commits into one, since they're conceptually the same; but this isn't necessary.)

@bstrie
Copy link
Contributor

bstrie commented Jul 21, 2013

I'd like one of the main developers to comment on this before anyone approves it. Operator overloads can be a contentious subject.

@brson
Copy link
Contributor

brson commented Jul 21, 2013

I'm not in favor of doing this. For me multiplying strings crosses the too-clever line.

@brendanzab
Copy link
Contributor

.repeat isn't really all that verbose, and much more readable.

@bstrie
Copy link
Contributor

bstrie commented Jul 22, 2013

I'm going to close this, as brson disapproves and I think Rust's general policy is that operator overloads should only be provided for common operations (which imo string repeating is not). @MaikKlein, feel free to open an issue rather than a PR if you wish to discuss it further.

@bstrie bstrie closed this Jul 22, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Nov 23, 2021
…shearth

Remove rustfmt::skip attribute from register_plugins function

r? `@Manishearth` since you added this in rust-lang#540 😄

changelog: none
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.

5 participants