Skip to content

Commit 725b45d

Browse files
committed
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 `?` because `try` is a reserved keyword since Rust 2018. An alternative would have been to use `r#try`, however `?` is more idiomatic in Rust 2018. There are no compat concerns, all Rust versions supported by `headers` support the edition 2018. - Update `Header` impl for `Link` to use the latest function signature. - Rephrase comment in `Header::decode` impl for `Link` (fix typo, improve clarity) - Use standard `Result` type, the code was previously relying on a local type alias for `Result<T, crate::Error>`. - Reformat with Rustfmt - Replace `::Error::Header` with `Error::invalid()` - Remove useless semicolon in `test_link_fmt_delimited` - Replace `Header::parse_header` with `crate::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`.
1 parent 12fb1d7 commit 725b45d

File tree

1 file changed

+167
-162
lines changed

1 file changed

+167
-162
lines changed

0 commit comments

Comments
 (0)