Skip to content

[BUG] [v0.0.7] cortex plugin new --advanced generates lib.rs with 7 compiler warnings: unused String/Vec/vec imports, dead UiRegion and ToastLevel variants, unused get_context and emit_event FFI #48553

@Grizouforever

Description

@Grizouforever

Project

ide

Description

Running cortex plugin new my-plugin --advanced generates an advanced Rust plugin template whose src/lib.rs produces 7 compiler warnings when built. Three imports are unused: alloc::string::String, alloc::vec::Vec, and the alloc::vec macro. Two enum types have variants that are never constructed: UiRegion variants Header, Footer, SidebarLeft, SidebarRight (only StatusBar is used), and ToastLevel variants Warning and Error (only Info and Success are used). Two FFI functions declared in the extern "C" block are never called: get_context and emit_event. A freshly scaffolded advanced template should compile cleanly with zero warnings.

Error Message

warning: unused import: `alloc::string::String` (src/lib.rs:15)
warning: unused import: `alloc::vec::Vec` (src/lib.rs:16)
warning: unused import: `alloc::vec` (src/lib.rs:17)
warning: variants `Header`, `Footer`, `SidebarLeft`, and `SidebarRight` are never constructed (src/lib.rs:55)
warning: variants `Warning` and `Error` are never constructed (src/lib.rs:93)
warning: function `get_context` is never used (src/lib.rs:26)
warning: function `emit_event` is never used (src/lib.rs:30)
warning: `adv-test` (lib) generated 7 warnings

Debug Logs

N/A

System Information

  • Cortex TUI v0.0.7
  • OS: Linux x86_64

Screenshots

screenshot

Steps to Reproduce

  1. Run cortex plugin new adv-test --advanced -o /tmp/test -d "Test" -a "Dev"
  2. cd /tmp/test/adv-test
  3. Run cargo build --target wasm32-wasip1 --release
  4. Observe 7 compiler warnings about unused imports, dead enum variants, and unused FFI functions

Expected Behavior

The generated advanced plugin template should compile with zero warnings. The template should either use all declared imports, enum variants, and FFI functions, or not include the unused ones.

Actual Behavior

The advanced template includes 3 unused imports, 6 unused enum variants across 2 enums, and 2 unused FFI function declarations, producing 7 compiler warnings on every build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ideIssues related to IDEvalidValid issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions