Skip to content

Remove useless String→String .into() conversions in remote.rs#1

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-clippy-linting-errors
Draft

Remove useless String→String .into() conversions in remote.rs#1
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-clippy-linting-errors

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 31, 2026

Clippy -D warnings was failing due to redundant .into() calls converting String to String (a no-op identity conversion) in the WebSocket handler of vida-core/src/remote.rs.

Changes

  • remote.rs: Remove two .into() calls after .to_string() — once in the deserialization error handler, once in the stream event sender
  • engine.rs, permissions.rs, agent_loop.rs, tool_validator.rs: Fix additional Clippy warnings blocking -D warnings compilation
// Before
socket.send(ws::Message::Text(
    serde_json::json!({"error": e.to_string()})
        .to_string()
        .into(),   // ← String → String, flagged by clippy::useless_conversion
))

// After
socket.send(ws::Message::Text(
    serde_json::json!({"error": e.to_string()})
        .to_string(),
))
Original prompt

The CI job is failing due to multiple Clippy linting errors in crates/vida-core/src/remote.rs:

  1. Useless conversion to the same type (lines 973-975):

    • The code calls .into() on a String after .to_string(), converting String to the same String type
    • This is redundant and should be removed
  2. Additional Clippy warnings that are preventing compilation with -D warnings

The job log shows:

error: useless conversion to the same type: `std::string::String`
   --> crates/vida-core/src/remote.rs:973:29
    |
973 |                   serde_json::json!({"error": e.to_string()})
974 |                      .to_string()
975 |                      .into(),
    |
= help: consider removing `.into()`

Fix all Clippy errors so the cargo clippy check passes with -D warnings.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.

Assistant: I'll help you find a solution for this failing job. Let me start by retrieving the job logs.

Assistant: Now let me check the failing file to understand the issue better:

Assistant: ## Solution

The job is failing due to Clippy linting errors in crates/vida-core/src/remote.rs. The main issue is a useless conversion on lines 973-975.

The Problem

At line 973-975, there's an unnecessary .into() conversion:

serde_json::json!({"error": e.to_string()})
    .to_string()
    .into(),

The code converts a serde_json::Value to a String via .to_string(), then calls .into() on a String type, which is converting it to the same String type. This is redundant.

The Fix

Remove the .into() call since String is already the correct type:

serde_json::json!({"error": e.to_string()})
    .to_string(),

Location: crates/vida-core/src/remote.rs, lines 973-975 in the chat_stream_handler function (inside the error handling for deserialization).

Updated Code

Replace this block:

Err(e) => {
    let _ = socket
        .send(ws::Message::Text(
            serde_json::json!({"error": e.to_string()})
                .to_string()
                .into(),
        ))
        .await;
    return;
}

With:

Err(e) => {
    let _ = socket
        .send(ws::Message::Text(
            serde_json::json!({"error": e.to_string()})
                .to_string(),
        ))
        .await;
    return;
}

This resolves the clippy::useless-conversion warning and allows the build to complete successfully.

User: corrige les erreurs

Assistant: Waiting for your confirmation to proceed with creating the pull request to fix the Clippy errors.

This pull request was created from Copilot chat.

Agent-Logs-Url: https://github.com/papajade55-debug/vida-ai/sessions/91b20081-06a3-437d-9c63-8214262e4e40

Co-authored-by: papajade55-debug <239186300+papajade55-debug@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Clippy linting errors in remote.rs Remove useless String→String .into() conversions in remote.rs Mar 31, 2026
Copilot AI requested a review from papajade55-debug March 31, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants