aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--azalea-brigadier/src/exceptions/command_syntax_exception.rs8
-rw-r--r--azalea-brigadier/src/string_reader.rs6
2 files changed, 10 insertions, 4 deletions
diff --git a/azalea-brigadier/src/exceptions/command_syntax_exception.rs b/azalea-brigadier/src/exceptions/command_syntax_exception.rs
index b9fbea45..38aa1c3a 100644
--- a/azalea-brigadier/src/exceptions/command_syntax_exception.rs
+++ b/azalea-brigadier/src/exceptions/command_syntax_exception.rs
@@ -1,4 +1,4 @@
-use std::{cmp, rc::Rc};
+use std::{cmp, fmt, rc::Rc};
use super::builtin_exceptions::BuiltInExceptions;
use crate::message::Message;
@@ -80,3 +80,9 @@ impl CommandSyntaxException {
self.cursor
}
}
+
+impl fmt::Debug for CommandSyntaxException {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ write!(f, "{}", self.message())
+ }
+}
diff --git a/azalea-brigadier/src/string_reader.rs b/azalea-brigadier/src/string_reader.rs
index 1119403a..4ef35ac0 100644
--- a/azalea-brigadier/src/string_reader.rs
+++ b/azalea-brigadier/src/string_reader.rs
@@ -187,7 +187,7 @@ impl StringReader<'_> {
pub fn read_unquoted_string(&mut self) -> &str {
let start = self.cursor;
- while self.can_read() && StringReader::<'_>::is_allowed_in_unquoted_string(self.peek()) {
+ while self.can_read() && StringReader::is_allowed_in_unquoted_string(self.peek()) {
self.skip();
}
&self.string[start..self.cursor]
@@ -395,7 +395,7 @@ mod test {
let mut reader = StringReader::from("hello world");
assert_eq!(reader.read_unquoted_string(), "hello");
assert_eq!(reader.get_read(), "hello");
- assert_eq!(reader.remaining(), "world");
+ assert_eq!(reader.remaining(), " world");
}
#[test]
@@ -417,7 +417,7 @@ mod test {
#[test]
fn read_quoted_string() {
let mut reader = StringReader::from("\"hello world\"");
- assert_eq!(reader.read_unquoted_string(), "hello world");
+ assert_eq!(reader.read_quoted_string().unwrap(), "hello world");
assert_eq!(reader.get_read(), "\"hello world\"");
assert_eq!(reader.remaining(), "");
}