21: Add a new test for a bad size hint r=bjorn3 a=Dr-Emann
Changes in PR rust-analyzer/smol_str#20 allow for an incorrect size hint to create a non-canonical SmolStr. Add a new test which will fail if we ever rely on
SmolStrs to be canonical when comparing for equality.
Co-authored-by: Zachary Dremann <dremann@gmail.com>
Changes in PR rust-analyzer/smol_str#20 allow for an incorrect size hint to create a
non-canonical SmolStr. Add a new test which will fail if we ever rely on
SmolStrs to be canonical when comparing for equality.
41: Remove unnecessary `Into<String>` bound from `From<T>` impl r=Veykril a=Veykril
Looks like this was forgotten when the bound got removed from the `new` constructor
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
26: Update CI badge in readme to point to Github Actions r=bjorn3 a=ComputerDruid
The Travis workflow was deleted in 3d5b7e3476f91280aedda3900c13838b00d64a9d
Co-authored-by: Daniel Johnson <ComputerDruid@gmail.com>
I don't really look at the results of the benchmarks anyway, so having
them in the repo creates a false sense of benchmarkdness.
If I get to implementing proper benchmarking, I'd probably stay away
from criterion -- we need something much much simpler for this crate.
When collecting from an iterator of chars, when expanding past
INLINE_CAP, include extra space for at least one byte per char for any
remaining known size.
By pulling `from_char_iter<I: Iterator>()` into a function, we can avoid
multiple monomorphizations of `FromIterator` when multiple
`IntoIterator`s result in the same iterator type.
Previously, the string was checked for starting with newlines and ending
with spaces, then ensuring that the length of those substrings were
short enough to use our constant. Instead, only do the check for as many
items as we have in the WS constant.
In the worst case, this avoids an O(n) check if the input is a long
string of `\n`, possibly followed by a long string of spaces.
16: Improve `Arc<str>` creation r=matklad a=sinkuu
While using `Into<String>` could avoid an allocation in `str` -> `String`,
converting `Box<str>` into `Arc<str>` [deallocates it and allocates new](https://doc.rust-lang.org/1.40.0/src/alloc/sync.rs.html#778-796) anyway.
The 1st commit is a drive-by simplification.
Co-authored-by: Shotaro Yamada <sinkuu@sinkuu.xyz>
15: Fix from_reader breaking in serde r=matklad a=bbqsrc
Had to move the `extern crate` outside as otherwise the compiler wouldn't have it.
Co-authored-by: Brendan Molloy <brendan@technocreatives.com>
13: new_inline_from_ascii: Docs and compile-fail tests r=matklad a=killercup
Just saw the compile-time invariants weren't tested so I used this little known feature of rustdoc to add some tests :)
Co-authored-by: Pascal Hertleif <pascal@technocreatives.com>