Skip to content

Commit

Permalink
[stdlib] Clean-up unneeded code
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Saelices <[email protected]>
  • Loading branch information
msaelices committed Sep 23, 2024
1 parent 1197496 commit 5b4311b
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 23 deletions.
3 changes: 2 additions & 1 deletion stdlib/src/builtin/string_literal.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ struct StringLiteral(
Formattable,
IntableRaising,
Stringable,
StringableKeyElement,
KeyElement,
Representable,
Sized,
FloatableRaising,
):
"""This type represents a string literal.
Expand Down
2 changes: 1 addition & 1 deletion stdlib/src/collections/__init__.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"""Implements the collections package."""

from .counter import Counter
from .dict import Dict, KeyElement, StringableKeyElement
from .dict import Dict, KeyElement
from .inline_array import InlineArray
from .inline_list import InlineList
from .list import List
Expand Down
19 changes: 0 additions & 19 deletions stdlib/src/collections/dict.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,6 @@ trait RepresentableKeyElement(KeyElement, Representable):
pass


trait StringableKeyElement(KeyElement, Stringable, Sized):
"""A trait composition for types which implement all requirements of
dictionary keys, Stringable and Sized with indexed."""

fn __getitem__[IndexerType: Indexer](self, idx: IndexerType) -> String:
"""Get the string representation of the type at the given index.
Parameters:
IndexerType: The type of the index.
Args:
idx: The index of the element to get the string representation of.
Returns:
The string representation of the element at the given index.
"""
...


@always_inline("nodebug")
fn _hash_small_str(s: String) -> UInt:
"""Hash a small data using the DJBX33A hash algorithm.
Expand Down
2 changes: 1 addition & 1 deletion stdlib/src/collections/string.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ struct String(
Sized,
Representable,
IntableRaising,
StringableKeyElement,
KeyElement,
Comparable,
Boolable,
Formattable,
Expand Down
2 changes: 1 addition & 1 deletion stdlib/src/prelude/__init__.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ from builtin.simd import (
)
from builtin.type_aliases import AnyTrivialRegType

from collections import KeyElement, List, StringableKeyElement
from collections import KeyElement, List
from collections.string import (
String,
ord,
Expand Down

0 comments on commit 5b4311b

Please sign in to comment.