Skip to repository content64 lines · 1.9 KB · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T06:49:59.186Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
lib.rs
1use gpui_shared_string::SharedString;
2
3// Should fire: `from` with a short literal (≤ 23 bytes).
4pub fn from_short() -> SharedString {
5 SharedString::from("Favorites")
6}
7
8// Should fire at elevated severity: `from` with a long literal (> 23 bytes).
9pub fn from_long() -> SharedString {
10 SharedString::from("Right-click for more options")
11}
12
13// Should fire: explicit `.into()` from a string literal.
14pub fn into_short() -> SharedString {
15 "hello".into()
16}
17
18// Should fire: `SharedString::new("...")`.
19pub fn new_short() -> SharedString {
20 SharedString::new("hi")
21}
22
23// Should NOT fire: the zero-cost constructor.
24pub fn new_static_short() -> SharedString {
25 SharedString::new_static("Favorites")
26}
27
28// Should NOT fire: non-literal input.
29pub fn from_variable(s: &str) -> SharedString {
30 SharedString::from(s)
31}
32
33// Should NOT fire: `.into()` on a non-literal.
34pub fn into_variable(s: &str) -> SharedString {
35 s.into()
36}
37
38// Should fire: `.into()` on a string literal that exceeds the 23-byte cap.
39pub fn into_long() -> SharedString {
40 "this literal is definitely longer than twenty three bytes".into()
41}
42
43// ---- owned_string_into_shared cases targeting `SharedString` ----
44
45// Should fire (owned_string_into_shared): `String::from(<lit>).into()`.
46pub fn shared_string_from_string_from() -> SharedString {
47 String::from("label").into()
48}
49
50// Should fire (owned_string_into_shared): `<lit>.to_string().into()`.
51pub fn shared_string_from_to_string() -> SharedString {
52 "label".to_string().into()
53}
54
55// Should fire (owned_string_into_shared): `<lit>.to_owned().into()`.
56pub fn shared_string_from_to_owned() -> SharedString {
57 "label".to_owned().into()
58}
59
60// Should NOT fire owned_string_into_shared: the source is a non-literal `String`.
61pub fn shared_string_from_dynamic_string(s: String) -> SharedString {
62 s.into()
63}
64