Skip to content

Commit

Permalink
Fmt and clippy fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
vaijira committed Mar 19, 2024
1 parent 5d037dc commit c6cd922
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
1 change: 0 additions & 1 deletion src/parsers/degiro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ impl DegiroParser {
"balance notes",
many0(|x| DegiroParser::balance_note(x, broker)),
)(input)
.map(|(next_input, res)| (next_input, res))
}

fn parse_account_notes(&self, notes: &str) -> Result<AccountNotes> {
Expand Down
13 changes: 5 additions & 8 deletions src/parsers/ib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl IBParser {
.map(|x| x.value())
.unwrap()
.as_element()
.map(|x| has_class(x))
.map(has_class)
== Some(true)
{
state = NoteState::Note;
Expand All @@ -173,7 +173,7 @@ impl IBParser {
.map(|x| x.value())
.unwrap()
.as_element()
.map(|x| has_class(x))
.map(has_class)
== Some(true)
{
state = NoteState::Invalid;
Expand Down Expand Up @@ -201,11 +201,8 @@ impl IBParser {

if let Some(element) = table_row.first_child().unwrap().value().as_element() {
if element.has_class("header-asset", CaseSensitivity::AsciiCaseInsensitive) {
if table_row.text().next() == Some(IBParser::STOCKS_STR) {
start_parsing_symbols = true;
} else {
start_parsing_symbols = false;
}
start_parsing_symbols =
table_row.text().next() == Some(IBParser::STOCKS_STR);
continue;
}
}
Expand Down Expand Up @@ -310,7 +307,7 @@ impl IBParser {
.map(|x| x.value())
.unwrap()
.as_element()
.map(|x| has_class(x))
.map(has_class)
== Some(true)
{
currency = table_row.text().next();
Expand Down
4 changes: 1 addition & 3 deletions src/reports/aeat_720.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,7 @@ impl Aeat720Report {
}

pub fn generate(self) -> Result<Vec<u8>> {
let mut result = Vec::new();

result.reserve(
let mut result = Vec::with_capacity(
AEAT_720_REGISTER_SIZE_BYTES * (self.details.len() + 1) + (self.details.len() + 1),
);

Expand Down
3 changes: 1 addition & 2 deletions src/utils/zip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ pub fn read_zip(data: Vec<u8>) -> Result<Vec<u8>> {
}

let mut file = archive.by_index(0)?;
let mut contents = Vec::new();
contents.reserve(file.size() as usize);
let mut contents = Vec::with_capacity(file.size() as usize);

file.read_exact(&mut contents)?;

Expand Down

0 comments on commit c6cd922

Please sign in to comment.