fix: resolve compilation errors for `link` module
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 the link 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 adding mod 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 for Link 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:
- The
try!macro was replaced with the try operator?becausetryis 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 byheaderssupport the edition 2018. - Update
Headerimpl forLinkto use the latest function signature. - Rephrase comment in
Header::decodeimpl forLink(fix typo, improve clarity) - Use standard
Resulttype, the code was previously relying on a local type alias forResult<T, crate::Error>. - Reformat with Rustfmt
- Replace
::Error::HeaderwithError::invalid() - Remove useless semicolon in
test_link_fmt_delimited - Replace
Header::parse_headerwithcrate::common::test_decode - Add module level documentation
- Update doc tests for
Link
Note: to compile, the code requires adding the dependency language_tags version 0.3.
This commit is a step towards #211.