Skip to content

Commit fdc747e

Browse files
committed
chore: Removed From<Token> implementation of BareName
It feels that `BareName` should not know about `Token`. Removed that implementation, it was only used in two places.
1 parent dae42c0 commit fdc747e

3 files changed

Lines changed: 2 additions & 9 deletions

File tree

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
use crate::pc::Token;
21
use rusty_common::{CaseInsensitiveString, Positioned};
32

43
pub type BareName = CaseInsensitiveString;
54
pub type BareNamePos = Positioned<BareName>;
6-
7-
impl From<Token> for BareName {
8-
fn from(token: Token) -> Self {
9-
Self::new(token.text)
10-
}
11-
}

rusty_parser/src/specific/core/expression.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ pub mod property {
883883
first_expr_pos,
884884
|prev_expr_pos, (name_token, opt_q_token)| {
885885
let property_name = Name::new(
886-
BareName::from(name_token),
886+
BareName::new(name_token.text),
887887
opt_q_token.as_ref().map(token_to_type_qualifier),
888888
);
889889
prev_expr_pos.map(|prev_expr| {

rusty_parser/src/specific/core/name.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ mod type_tests {
178178
///
179179
/// Use case: user defined type elements or types.
180180
pub fn bare_name_without_dots() -> impl Parser<RcStringView, Output = BareName> {
181-
ensure_no_trailing_dot_or_qualifier(identifier()).map(BareName::from)
181+
ensure_no_trailing_dot_or_qualifier(identifier()).map(|token| BareName::new(token.text))
182182
}
183183

184184
/// Parses an identifier token.

0 commit comments

Comments
 (0)