Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 0 additions & 127 deletions lib/smol_str/.github/ci.rs

This file was deleted.

36 changes: 0 additions & 36 deletions lib/smol_str/.github/workflows/ci.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions lib/smol_str/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion lib/smol_str/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "small-string optimized string type with O(1) clone"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/rust-analyzer/tree/master/lib/smol_str"
authors = ["Aleksey Kladov <[email protected]>", "Lukas Wirth <[email protected]>"]
edition = "2021"
edition = "2024"
rust-version = "1.89"

[package.metadata.docs.rs]
Expand Down
4 changes: 2 additions & 2 deletions lib/smol_str/benches/bench.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use criterion::{criterion_group, criterion_main, Criterion};
use criterion::{Criterion, criterion_group, criterion_main};
use rand::distr::{Alphanumeric, SampleString};
use smol_str::{format_smolstr, SmolStr, StrExt, ToSmolStr};
use smol_str::{SmolStr, StrExt, ToSmolStr, format_smolstr};
use std::hint::black_box;

/// 12: small (inline)
Expand Down
2 changes: 0 additions & 2 deletions lib/smol_str/bors.toml

This file was deleted.

4 changes: 2 additions & 2 deletions lib/smol_str/src/borsh.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::{Repr, SmolStr, INLINE_CAP};
use crate::{INLINE_CAP, Repr, SmolStr};
use alloc::string::{String, ToString};
use borsh::{
io::{Error, ErrorKind, Read, Write},
BorshDeserialize, BorshSerialize,
io::{Error, ErrorKind, Read, Write},
};
use core::mem::transmute;

Expand Down
39 changes: 19 additions & 20 deletions lib/smol_str/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,7 @@ impl FromStr for SmolStr {
const INLINE_CAP: usize = InlineSize::_V23 as usize;
const N_NEWLINES: usize = 32;
const N_SPACES: usize = 128;
const WS: &str =
"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n ";
const WS: &str = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n ";
const _: () = {
assert!(WS.len() == N_NEWLINES + N_SPACES);
assert!(WS.as_bytes()[N_NEWLINES - 1] == b'\n');
Expand Down Expand Up @@ -690,24 +689,24 @@ impl StrExt for str {
#[inline]
fn replacen_smolstr(&self, from: &str, to: &str, mut count: usize) -> SmolStr {
// Fast path for replacing a single ASCII character with another inline.
if let [from_u8] = from.as_bytes() {
if let [to_u8] = to.as_bytes() {
return if self.len() <= count {
// SAFETY: `from_u8` & `to_u8` are ascii
unsafe { replacen_1_ascii(self, |b| if b == from_u8 { *to_u8 } else { *b }) }
} else {
unsafe {
replacen_1_ascii(self, |b| {
if b == from_u8 && count != 0 {
count -= 1;
*to_u8
} else {
*b
}
})
}
};
}
if let [from_u8] = from.as_bytes()
&& let [to_u8] = to.as_bytes()
{
return if self.len() <= count {
// SAFETY: `from_u8` & `to_u8` are ascii
unsafe { replacen_1_ascii(self, |b| if b == from_u8 { *to_u8 } else { *b }) }
} else {
unsafe {
replacen_1_ascii(self, |b| {
if b == from_u8 && count != 0 {
count -= 1;
*to_u8
} else {
*b
}
})
}
};
}

let mut result = SmolStrBuilder::new();
Expand Down
54 changes: 0 additions & 54 deletions lib/text-size/.github/workflows/ci.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions lib/text-size/.gitignore

This file was deleted.

7 changes: 5 additions & 2 deletions lib/text-size/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "text-size"
version = "1.1.1"
edition = "2018"
edition = "2024"

authors = [
"Aleksey Kladov <[email protected]>",
Expand All @@ -13,7 +13,7 @@ repository = "https://github.com/rust-analyzer/text-size"
documentation = "https://docs.rs/text-size"

[dependencies]
serde = { version = "1.0", optional = true, default_features = false }
serde = { version = "1.0", optional = true, default-features = false }

[dev-dependencies]
serde_test = "1.0"
Expand All @@ -23,3 +23,6 @@ static_assertions = "1.1"
name = "serde"
path = "tests/serde.rs"
required-features = ["serde"]

[lints]
workspace = true
6 changes: 0 additions & 6 deletions lib/text-size/bors.toml

This file was deleted.

2 changes: 1 addition & 1 deletion lib/text-size/src/serde_impls.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use {
crate::{TextRange, TextSize},
serde::{de, Deserialize, Deserializer, Serialize, Serializer},
serde::{Deserialize, Deserializer, Serialize, Serializer, de},
};

impl Serialize for TextSize {
Expand Down
Loading