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

Make const as many functions as possible #759

Merged
merged 2 commits into from
Jun 16, 2024
Merged

Make const as many functions as possible #759

merged 2 commits into from
Jun 16, 2024

Conversation

Mingun
Copy link
Collaborator

@Mingun Mingun commented Jun 16, 2024

I think, that all those functions are such basic, that unlikely will be changed in that way that would prevent them from being const. So I added this keyword.

This is all that can be const at the moment, I checked all the other functions.

@Mingun Mingun requested a review from dralley June 16, 2024 10:25
@codecov-commenter
Copy link

codecov-commenter commented Jun 16, 2024

Codecov Report

Attention: Patch coverage is 92.78351% with 7 lines in your changes missing coverage. Please review.

Project coverage is 61.88%. Comparing base (7558577) to head (4543ba6).
Report is 2 commits behind head on master.

Files Patch % Lines
src/de/mod.rs 40.00% 3 Missing ⚠️
src/reader/mod.rs 77.77% 2 Missing ⚠️
src/reader/ns_reader.rs 50.00% 1 Missing ⚠️
src/writer.rs 50.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #759      +/-   ##
==========================================
+ Coverage   61.81%   61.88%   +0.06%     
==========================================
  Files          41       41              
  Lines       16798    16838      +40     
==========================================
+ Hits        10384    10420      +36     
- Misses       6414     6418       +4     
Flag Coverage Δ
unittests 61.88% <92.78%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

is_whitespace is trivial therefore not tested
Also make `name_len` function `const`
- Attr::key()
- Attr::value()
- Attributes::html()
- Attributes::new()
- BytesDecl::from_start()
- Decoder::encoding()
- Deserializer::get_ref()
- IoReader::get_ref()
- LocalName::into_inner()
- Namespace::into_inner()
- NsReader::config()
- NsReader::prefixes()
- Prefix::into_inner()
- QName::into_inner()
- Reader::buffer_position()
- Reader::config()
- Reader::decoder()
- Reader::error_position()
- Reader::get_ref()
- resolve_html5_entity()
- resolve_predefined_entity()
- resolve_xml_entity()
- SliceReader::get_ref()
- Writer::get_ref()
- Writer::new()
@Mingun Mingun merged commit 5629ac7 into tafia:master Jun 16, 2024
6 checks passed
@Mingun Mingun deleted the const branch June 16, 2024 18:36
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.

None yet

3 participants