Skip to content

Commit f15383f

Browse files
authored
Merge pull request #422 from dtolnay/newchecked
Rename internal Ident::new -> Ident::new_checked
2 parents 8059195 + ea2cd7f commit f15383f

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/fallback.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ pub(crate) struct Ident {
755755
}
756756

757757
impl Ident {
758-
pub fn new(string: &str, span: Span) -> Self {
758+
pub fn new_checked(string: &str, span: Span) -> Self {
759759
validate_ident(string);
760760
Ident::new_unchecked(string, span)
761761
}
@@ -768,7 +768,7 @@ impl Ident {
768768
}
769769
}
770770

771-
pub fn new_raw(string: &str, span: Span) -> Self {
771+
pub fn new_raw_checked(string: &str, span: Span) -> Self {
772772
validate_ident_raw(string);
773773
Ident::new_raw_unchecked(string, span)
774774
}

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ impl Ident {
951951
/// style="padding-left:0;">::&lt;Ident&gt;</code>
952952
/// rather than `Ident::new`.
953953
pub fn new(string: &str, span: Span) -> Self {
954-
Ident::_new(imp::Ident::new(string, span.inner))
954+
Ident::_new(imp::Ident::new_checked(string, span.inner))
955955
}
956956

957957
/// Same as `Ident::new`, but creates a raw identifier (`r#ident`). The
@@ -960,7 +960,7 @@ impl Ident {
960960
/// segments (e.g. `self`, `super`) are not supported, and will cause a
961961
/// panic.
962962
pub fn new_raw(string: &str, span: Span) -> Self {
963-
Ident::_new(imp::Ident::new_raw(string, span.inner))
963+
Ident::_new(imp::Ident::new_raw_checked(string, span.inner))
964964
}
965965

966966
/// Returns the span of this `Ident`.

src/wrapper.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -639,21 +639,21 @@ pub(crate) enum Ident {
639639
}
640640

641641
impl Ident {
642-
pub fn new(string: &str, span: Span) -> Self {
642+
pub fn new_checked(string: &str, span: Span) -> Self {
643643
match span {
644644
Span::Compiler(s) => Ident::Compiler(proc_macro::Ident::new(string, s)),
645-
Span::Fallback(s) => Ident::Fallback(fallback::Ident::new(string, s)),
645+
Span::Fallback(s) => Ident::Fallback(fallback::Ident::new_checked(string, s)),
646646
}
647647
}
648648

649649
pub fn new_unchecked(string: &str, span: fallback::Span) -> Self {
650650
Ident::Fallback(fallback::Ident::new_unchecked(string, span))
651651
}
652652

653-
pub fn new_raw(string: &str, span: Span) -> Self {
653+
pub fn new_raw_checked(string: &str, span: Span) -> Self {
654654
match span {
655655
Span::Compiler(s) => Ident::Compiler(proc_macro::Ident::new_raw(string, s)),
656-
Span::Fallback(s) => Ident::Fallback(fallback::Ident::new_raw(string, s)),
656+
Span::Fallback(s) => Ident::Fallback(fallback::Ident::new_raw_checked(string, s)),
657657
}
658658
}
659659

0 commit comments

Comments
 (0)