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

Avoid slicing a string in DocParsingError. #1559

Merged
merged 1 commit into from
Sep 26, 2022

Conversation

waywardmonkeys
Copy link
Contributor

Fixes #1339.

@waywardmonkeys
Copy link
Contributor Author

I'm not convinced that this is better since there are still allocations, etc ... but the code is shorter and it is only an error path thing.

@codecov-commenter
Copy link

Codecov Report

Merging #1559 (79a93bb) into main (10f10a3) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1559   +/-   ##
=======================================
  Coverage   93.82%   93.83%           
=======================================
  Files         250      250           
  Lines       46117    46117           
=======================================
+ Hits        43269    43272    +3     
+ Misses       2848     2845    -3     
Impacted Files Coverage Δ
src/schema/schema.rs 98.71% <100.00%> (+0.16%) ⬆️
src/fastfield/multivalued/mod.rs 98.02% <0.00%> (-0.40%) ⬇️
src/indexer/segment_writer.rs 96.42% <0.00%> (+0.53%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

format!("{:?}...", &invalid_json[0..20])
};
DocParsingError::InvalidJson(sample_json)
let sample = invalid_json.chars().take(20).collect();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the best would be std::floor_char_boundary but it is not available in stable.

@fulmicoton fulmicoton merged commit 97ccd6d into quickwit-oss:main Sep 26, 2022
@waywardmonkeys waywardmonkeys deleted the issue-1339 branch September 26, 2022 11:31
@fmassot
Copy link
Contributor

fmassot commented Sep 26, 2022

nice :)
thanks @waywardmonkeys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid slicing a string in DocParsingError
4 participants