Skip to content

Commit f8f9428

Browse files
committed
Refactor formatting and imports in str modules and tests
Improved code formatting in src/str/advanced.gleam for readability, updated import style, and adjusted type definitions. Cleaned up imports in test/str_config_test.gleam and reformatted assertions in test/str_core_test.gleam for consistency.
1 parent 6866dde commit f8f9428

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

src/str/advanced.gleam

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//// of KMP maps, or want to benchmark/compare algorithms.
66

77
import gleam/dict
8-
import str/internal/core as core
8+
import str/internal/core
99

1010
/// Builds KMP prefix/lookup maps for a pattern.
1111
pub fn build_kmp_maps(
@@ -54,13 +54,16 @@ pub fn sliding_index_of(text: String, pattern: String) -> Result(Int, Nil) {
5454
}
5555

5656
/// Chooses optimal search strategy using the library's heuristics.
57-
pub fn choose_search_strategy(text: String, pattern: String) -> core.SearchStrategy {
57+
pub fn choose_search_strategy(
58+
text: String,
59+
pattern: String,
60+
) -> core.SearchStrategy {
5861
core.choose_search_strategy(text, pattern)
5962
}
6063

6164
/// Helper types for users building caches.
62-
pub type KmpMaps = #(dict.Dict(Int, String), dict.Dict(Int, Int))
63-
65+
pub type KmpMaps =
66+
#(dict.Dict(Int, String), dict.Dict(Int, Int))
6467
/// NOTE: This module is "advanced" — functions here give fine-grained
6568
/// control and are intended for performance-sensitive code paths. They
6669
/// may change across minor releases; prefer `import str` for stable APIs.

test/str_config_test.gleam

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import str
21
import gleam/list
2+
import str
3+
34
// removed unused import
45

56
pub fn smart_search_default_test() {

test/str_core_test.gleam

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,8 +1022,7 @@ pub fn rpartition_not_found_test() {
10221022
}
10231023

10241024
pub fn rpartition_multi_char_sep_test() {
1025-
assert str.rpartition("one::two::three", "::")
1026-
== #("one::two", "::", "three")
1025+
assert str.rpartition("one::two::three", "::") == #("one::two", "::", "three")
10271026
}
10281027

10291028
pub fn rpartition_single_occurrence_test() {

0 commit comments

Comments
 (0)