-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Labels
type: bugThis fixes a bug. Increment the minor versionThis fixes a bug. Increment the minor version
Description
General Information
Version: current
Installation Method: git cloned locally and built
Operating System: amd64 Debian 12 'Bookworm'
I initially just tried: cargo install wiki-tui and there were all these errors. So, I resolved to build and compile the project from source.
Describe the bug
Problem 1: ratatui Version Mismatch
- Symptom: The initial build failed with numerous
mismatched typeserrors, involvingratatui::widgets::Blockandratatui::style::Style. - Cause: The project was using multiple versions of the
ratatuicrate due to its direct dependencies using one version and one of its indirect dependencies using an older version. This meant types with the same fully qualified name were actually different because they were from different crate versions. - Solution:
- Identify Problematic Dependency: The
tui-loggercrate, a dependency of the project was the culprit because it used an older version ofratatui. - Explicitly set
ratatuiversion: We updated theCargo.tomlfile to explicitly specify a single, consistent version ofratatui(0.27.0in this case) in the[dependencies]section:[dependencies] ratatui = "0.27.0" # ... other dependencies
- Clean the project: We ran
cargo cleanto remove old build artifacts and ensure that Cargo would resolve dependencies with the updated version. - Rebuild: We used
cargo buildto compile the project with the single, specified version ofratatui.
- Result: This resolved the type mismatches caused by having multiple versions of
ratatuiin our dependency tree.
- Identify Problematic Dependency: The
Problem 2: Incorrect Usage of area.inner()
- Symptom: A new build error arose after resolving the
ratatuiversion mismatch, complaining about mismatched types betweenMarginand&Marginwhen using thearea.inner()method. - Cause: The
inner()method fromratatuiexpects aMarginstruct to be passed by value, but the code was passing a reference (&Margin). - Solution:
- Locate the error: We used the compiler's error message to pinpoint the file
src/components/page.rsat line 716 as the source of the error. - Remove the
&: We changed:to:area.inner(&Margin { ... });
area.inner(Margin { ... });
inner.- Result: This resolved the type mismatch, allowing the code to compile.
- Locate the error: We used the compiler's error message to pinpoint the file
Problem 3: Deprecated Padding::zero() Usage
- Symptom: A warning indicated that the
Padding::zero()function was deprecated and recommended using the constantPadding::ZERO. - Cause: The code was using an old deprecated way of creating padding.
- Solution:
- Locate the warning: We used the compiler warning message to pinpoint the file
src/config.rsat line 478 as the source of the warning. - Replace
Padding::zero()withPadding::ZERO: We replaced
padding: Padding::zero(),
with: ```rust padding: Padding::ZERO, ```- Result: This resolved the warning and the code is using the modern and recommended API.
- Locate the warning: We used the compiler warning message to pinpoint the file
Final Result:
- After implementing these steps, the
wiki-tuiproject compiled successfully, without errors and with no warnings. - The project now uses a single, consistent version of
ratatui. - The
area.inner()andPaddingmethods are called correctly.
Expected behavior
I expected to be able to install the project with cargo in the first instance. In the second, I expected to be able to build the binary from source without a hitch. Please forgive me for not making a pull request with the changes, but I am very new to rust.
Metadata
Metadata
Assignees
Labels
type: bugThis fixes a bug. Increment the minor versionThis fixes a bug. Increment the minor version
Projects
Status
Todo