Skip to content

Commit

Permalink
internal: replace PathBuf with Utf8PathBuf in lsp/ext.rs; `proj…
Browse files Browse the repository at this point in the history
…ect_json.rs`
  • Loading branch information
davidbarsky committed Jun 10, 2024
1 parent e855e9c commit 0dc68a9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
11 changes: 5 additions & 6 deletions crates/project-model/src/project_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ use paths::{AbsPath, AbsPathBuf, Utf8PathBuf};
use rustc_hash::FxHashMap;
use serde::{de, Deserialize, Serialize};
use span::Edition;
use std::path::PathBuf;

use crate::{cfg::CfgFlag, ManifestPath, TargetKind};

Expand Down Expand Up @@ -101,7 +100,7 @@ pub struct Build {
/// build system being used.
pub label: String,
/// Path corresponding to the build system-specific file defining the crate.
pub build_file: PathBuf,
pub build_file: Utf8PathBuf,
/// What kind of target is this crate? For example, we don't want
/// to offer a 'run' button for library crates.
pub target_kind: TargetKind,
Expand All @@ -111,7 +110,7 @@ pub struct Build {
pub struct Runnable {
pub program: String,
pub args: Vec<String>,
pub cwd: PathBuf,
pub cwd: Utf8PathBuf,
pub kind: RunnableKind,
}

Expand Down Expand Up @@ -279,18 +278,18 @@ enum EditionData {
Edition2024,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BuildData {
label: String,
build_file: PathBuf,
build_file: Utf8PathBuf,
target_kind: TargetKindData,
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct RunnableData {
pub program: String,
pub args: Vec<String>,
pub cwd: PathBuf,
pub cwd: Utf8PathBuf,
pub kind: RunnableKindData,
}

Expand Down
8 changes: 4 additions & 4 deletions crates/rust-analyzer/src/lsp/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#![allow(clippy::disallowed_types)]

use std::ops;
use std::path::PathBuf;

use ide_db::line_index::WideEncoding;
use lsp_types::request::Request;
Expand All @@ -12,6 +11,7 @@ use lsp_types::{
PartialResultParams, Position, Range, TextDocumentIdentifier, WorkDoneProgressParams,
};
use lsp_types::{PositionEncodingKind, Url};
use paths::Utf8PathBuf;
use rustc_hash::FxHashMap;
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -463,9 +463,9 @@ pub struct CargoRunnableArgs {
// command to be executed instead of cargo
pub override_cargo: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub workspace_root: Option<PathBuf>,
pub workspace_root: Option<Utf8PathBuf>,
#[serde(skip_serializing_if = "Option::is_none")]
pub cwd: Option<PathBuf>,
pub cwd: Option<Utf8PathBuf>,
// command, --package and --lib stuff
pub cargo_args: Vec<String>,
// user-specified additional cargo args, like `--release`.
Expand All @@ -481,7 +481,7 @@ pub struct CargoRunnableArgs {
pub struct ShellRunnableArgs {
pub program: String,
pub args: Vec<String>,
pub cwd: PathBuf,
pub cwd: Utf8PathBuf,
}

pub enum RelatedTests {}
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/lsp-extensions.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!---
lsp/ext.rs hash: 954e00b9191a5e7f
lsp/ext.rs hash: 8e6e340f2899b5e9
If you need to change the above hash to make the test pass, please check if you
need to adjust this doc as well and ping this issue:
Expand Down

0 comments on commit 0dc68a9

Please sign in to comment.