fix: resolve compilation errors for link
module
#212
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
link
module is currently located in the./src/disabled
directory. The content of this directory is not mounted as a module in the crate source, so it is not compiled by default. Over time, the code structure, language features and dependencies changed, but thelink
module was not kept up to date and now the module no longer compiles.This commit fixes compilation errors for the existing
link
module. This was achieved by temporarily addingmod disabled { mod link; }
in the root module and addressing all the errors reported by the compiler. While this commit is part of an overall effort of adding support forLink
headers, this specific commit restricts its code changes purely to compilation errors. In particular, it does not introduce any change in behavior, and the module remains disabled.Here is the detailed list of changes:
try!
macro was replaced with the try operator?
becausetry
is a reserved keyword since Rust 2018. An alternative would have been to user#try
, however?
is more idiomatic in Rust 2018. There are no compat concerns, all Rust versions supported byheaders
support the edition 2018.Header
impl forLink
to use the latest function signature.Header::decode
impl forLink
(fix typo, improve clarity)Result
type, the code was previously relying on a local type alias forResult<T, crate::Error>
.::Error::Header
withError::invalid()
test_link_fmt_delimited
Header::parse_header
withcrate::common::test_decode
Link
Note: to compile, the code requires adding the dependency
language_tags
version0.3
.This commit is a step towards #211.