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

rename some misspelled variables #38

Merged
merged 1 commit into from
Jun 25, 2023
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
18 changes: 9 additions & 9 deletions src/formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,32 +54,32 @@ pub(crate) fn format_inner(contents: &[u8], _config: &Config) -> Vec<u8> {
}
}

let mut c_bites = working_set.get_span_contents(span);
let content = String::from_utf8_lossy(c_bites).to_string();
let mut bytes = working_set.get_span_contents(span);
let content = String::from_utf8_lossy(bytes).to_string();
trace!("shape is {shape}");
trace!("shape contents: {:?}", &content);

match shape {
FlatShape::String | FlatShape::Int | FlatShape::Nothing => out.extend(c_bites),
FlatShape::String | FlatShape::Int | FlatShape::Nothing => out.extend(bytes),
FlatShape::List | FlatShape::Record => {
c_bites = trim_ascii_whitespace(c_bites);
let printable = String::from_utf8_lossy(c_bites).to_string();
bytes = trim_ascii_whitespace(bytes);
let printable = String::from_utf8_lossy(bytes).to_string();
trace!("stripped the whitespace, result: {:?}", printable);
out.extend(c_bites);
out.extend(bytes);
}
FlatShape::Pipe => {
out.extend(b"| ");
}
FlatShape::External | FlatShape::ExternalArg => {
out.extend(c_bites);
out.extend(bytes);
out.extend(b" ");
}
FlatShape::Garbage => {
out.extend(c_bites);
out.extend(bytes);
out = insert_newline(out);
}

_ => out.extend(c_bites),
_ => out.extend(bytes),
}

if is_last_span(span, &flat) && span.end < end_of_file {
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ pub fn format_single_file(file: &PathBuf, config: &Config) {
}

let mut writer = File::create(file).unwrap();
let file_bites = formatted_bytes.as_slice();
let file_bytes = formatted_bytes.as_slice();
writer
.write_all(file_bites)
.write_all(file_bytes)
.expect("something went wrong writing");
trace!("written");
}
Expand Down