Skip to content

Commit 31084b4

Browse files
committed
Rename Punct::op to ch, print as char
1 parent 2728fbe commit 31084b4

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ impl Debug for Group {
696696
/// `Punct` with different forms of `Spacing` returned.
697697
#[derive(Clone)]
698698
pub struct Punct {
699-
op: char,
699+
ch: char,
700700
spacing: Spacing,
701701
span: Span,
702702
}
@@ -722,17 +722,17 @@ impl Punct {
722722
///
723723
/// The returned `Punct` will have the default span of `Span::call_site()`
724724
/// which can be further configured with the `set_span` method below.
725-
pub fn new(op: char, spacing: Spacing) -> Punct {
725+
pub fn new(ch: char, spacing: Spacing) -> Punct {
726726
Punct {
727-
op,
727+
ch,
728728
spacing,
729729
span: Span::call_site(),
730730
}
731731
}
732732

733733
/// Returns the value of this punctuation character as `char`.
734734
pub fn as_char(&self) -> char {
735-
self.op
735+
self.ch
736736
}
737737

738738
/// Returns the spacing of this punctuation character, indicating whether
@@ -759,14 +759,14 @@ impl Punct {
759759
/// convertible back into the same character.
760760
impl Display for Punct {
761761
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
762-
Display::fmt(&self.op, f)
762+
Display::fmt(&self.ch, f)
763763
}
764764
}
765765

766766
impl Debug for Punct {
767767
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
768768
let mut debug = fmt.debug_struct("Punct");
769-
debug.field("op", &self.op);
769+
debug.field("char", &self.ch);
770770
debug.field("spacing", &self.spacing);
771771
imp::debug_span_field_if_nontrivial(&mut debug, self.span.inner);
772772
debug.finish()

tests/test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ TokenStream [
341341
sym: a,
342342
},
343343
Punct {
344-
op: '+',
344+
char: '+',
345345
spacing: Alone,
346346
},
347347
Literal {
@@ -362,7 +362,7 @@ TokenStream [
362362
sym: a
363363
},
364364
Punct {
365-
op: '+',
365+
char: '+',
366366
spacing: Alone
367367
},
368368
Literal {
@@ -384,7 +384,7 @@ TokenStream [
384384
span: bytes(2..3),
385385
},
386386
Punct {
387-
op: '+',
387+
char: '+',
388388
spacing: Alone,
389389
span: bytes(4..5),
390390
},
@@ -409,7 +409,7 @@ TokenStream [
409409
span: bytes(2..3)
410410
},
411411
Punct {
412-
op: '+',
412+
char: '+',
413413
spacing: Alone,
414414
span: bytes(4..5)
415415
},

0 commit comments

Comments
 (0)