Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typos #133

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion corewars-parser/src/phase/expansion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
pub origin: Option<String>,
}

/// Collect and subsitute all labels found in the input lines.
/// Collect and substitute all labels found in the input lines.
pub fn expand(mut text: Vec<String>, mut origin: Option<String>) -> Lines {
let labels = collect_and_expand(&mut text);

Expand Down Expand Up @@ -60,7 +60,7 @@

// Returns true if anything was expanded, false otherwise
let mut expand_next_token = |collector: &Collector, is_for_expr: bool| {
for token in tokenized_line[1..].iter() {

Check warning on line 63 in corewars-parser/src/phase/expansion.rs

View workflow job for this annotation

GitHub Actions / lint

it is more concise to loop over references to containers instead of using explicit iteration methods
if token.as_rule() == Rule::Label {
let label_value = collector.get_label_value(token.as_str(), offset);

Expand Down Expand Up @@ -224,7 +224,7 @@
offset += 1;

let next_token = tokenized_line[1].as_span();
lines[i] = line[next_token.start()..].to_owned();

Check warning on line 227 in corewars-parser/src/phase/expansion.rs

View workflow job for this annotation

GitHub Actions / lint

assigning the result of `ToOwned::to_owned()` may be inefficient
} else {
lines.remove(i);
continue;
Expand Down Expand Up @@ -418,7 +418,7 @@

self.resolve_pending_equ();

self.labels.extend(result.into_iter());

Check warning on line 421 in corewars-parser/src/phase/expansion.rs

View workflow job for this annotation

GitHub Actions / lint

explicit call to `.into_iter()` in function argument accepting `IntoIterator`
}

fn resolve_pending_equ(&mut self) {
Expand Down
2 changes: 1 addition & 1 deletion corewars-parser/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl<T> Result<T> {
}
}

/// Unwrap the parse result, panicking with the given mesasge if it was not an `Ok`.
/// Unwrap the parse result, panicking with the given message if it was not an `Ok`.
pub fn expect(self, msg: &str) -> T {
match self {
Self::Ok(value, _) => value,
Expand Down
2 changes: 1 addition & 1 deletion testdata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ Taken from [Wilkie's benchmark](http://www.koth.org/wilkies/) on KOTH.

### WilMoo Benchmark

Taken from the [WilMoo benchmar](http://www.koth.org/wilmoo/) on KOTH.
Taken from the [WilMoo benchmark](http://www.koth.org/wilmoo/) on KOTH.
Loading