aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-03-27 17:25:51 -0600
committerMelody Horn <melody@boringcactus.com>2021-03-27 17:25:51 -0600
commite7300dc5f2c0787623286d83d54f6a26b08ff907 (patch)
treeaa5c7b49ae71b1c7ee7cd6c4a45997657be270de /src
parent7e998f46d5a7067bc921f1038e914f47bc1607ab (diff)
downloadmakers-e7300dc5f2c0787623286d83d54f6a26b08ff907.tar.gz
makers-e7300dc5f2c0787623286d83d54f6a26b08ff907.zip
use Self more often in token
Diffstat (limited to 'src')
-rw-r--r--src/makefile/token.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/makefile/token.rs b/src/makefile/token.rs
index 4fde3e5..811f30f 100644
--- a/src/makefile/token.rs
+++ b/src/makefile/token.rs
@@ -27,7 +27,7 @@ impl TokenString {
&mut self.0[0]
}
- pub(crate) fn split_once(&self, delimiter: char) -> Option<(TokenString, TokenString)> {
+ pub(crate) fn split_once(&self, delimiter: char) -> Option<(Self, Self)> {
let mut result0 = vec![];
let mut iter = self.0.iter();
while let Some(t) = iter.next() {
@@ -39,7 +39,7 @@ impl TokenString {
result0.push(Token::Text(pieces[0].into()));
let mut result1 = vec![Token::Text(pieces[1].into())];
result1.extend(iter.cloned());
- return Some((TokenString(result0), TokenString(result1)));
+ return Some((Self(result0), Self(result1)));
}
_ => result0.push(t.clone()),
}
@@ -62,7 +62,7 @@ impl TokenString {
}
}
- pub(crate) fn extend(&mut self, other: TokenString) {
+ pub(crate) fn extend(&mut self, other: Self) {
self.0.extend(other.0);
}
@@ -94,12 +94,12 @@ pub(crate) enum Token {
impl fmt::Display for Token {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
- Token::Text(t) => write!(f, "{}", t),
- Token::MacroExpansion {
+ Self::Text(t) => write!(f, "{}", t),
+ Self::MacroExpansion {
name,
replacement: None,
} => write!(f, "$({})", name),
- Token::MacroExpansion {
+ Self::MacroExpansion {
name,
replacement: Some((r1, r2)),
} => write!(f, "$({}:{}={})", name, r1, r2),