Skip to content

Commit c062791

Browse files
committed
internal: replace PathBuf with Utf8PathBuf in lsp/ext.rs; project_json.rs
1 parent e855e9c commit c062791

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

crates/project-model/src/project_json.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ use paths::{AbsPath, AbsPathBuf, Utf8PathBuf};
5454
use rustc_hash::FxHashMap;
5555
use serde::{de, Deserialize, Serialize};
5656
use span::Edition;
57-
use std::path::PathBuf;
5857

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

@@ -101,7 +100,7 @@ pub struct Build {
101100
/// build system being used.
102101
pub label: String,
103102
/// Path corresponding to the build system-specific file defining the crate.
104-
pub build_file: PathBuf,
103+
pub build_file: Utf8PathBuf,
105104
/// What kind of target is this crate? For example, we don't want
106105
/// to offer a 'run' button for library crates.
107106
pub target_kind: TargetKind,
@@ -111,7 +110,7 @@ pub struct Build {
111110
pub struct Runnable {
112111
pub program: String,
113112
pub args: Vec<String>,
114-
pub cwd: PathBuf,
113+
pub cwd: Utf8PathBuf,
115114
pub kind: RunnableKind,
116115
}
117116

@@ -279,18 +278,18 @@ enum EditionData {
279278
Edition2024,
280279
}
281280

282-
#[derive(Serialize, Deserialize, Debug, Clone)]
281+
#[derive(Debug, Clone, Serialize, Deserialize)]
283282
pub struct BuildData {
284283
label: String,
285-
build_file: PathBuf,
284+
build_file: Utf8PathBuf,
286285
target_kind: TargetKindData,
287286
}
288287

289288
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
290289
pub struct RunnableData {
291290
pub program: String,
292291
pub args: Vec<String>,
293-
pub cwd: PathBuf,
292+
pub cwd: Utf8PathBuf,
294293
pub kind: RunnableKindData,
295294
}
296295

crates/rust-analyzer/src/lsp/ext.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![allow(clippy::disallowed_types)]
44

55
use std::ops;
6-
use std::path::PathBuf;
76

87
use ide_db::line_index::WideEncoding;
98
use lsp_types::request::Request;
@@ -12,6 +11,7 @@ use lsp_types::{
1211
PartialResultParams, Position, Range, TextDocumentIdentifier, WorkDoneProgressParams,
1312
};
1413
use lsp_types::{PositionEncodingKind, Url};
14+
use paths::Utf8PathBuf;
1515
use rustc_hash::FxHashMap;
1616
use serde::{Deserialize, Serialize};
1717

@@ -463,9 +463,9 @@ pub struct CargoRunnableArgs {
463463
// command to be executed instead of cargo
464464
pub override_cargo: Option<String>,
465465
#[serde(skip_serializing_if = "Option::is_none")]
466-
pub workspace_root: Option<PathBuf>,
466+
pub workspace_root: Option<Utf8PathBuf>,
467467
#[serde(skip_serializing_if = "Option::is_none")]
468-
pub cwd: Option<PathBuf>,
468+
pub cwd: Option<Utf8PathBuf>,
469469
// command, --package and --lib stuff
470470
pub cargo_args: Vec<String>,
471471
// user-specified additional cargo args, like `--release`.
@@ -481,7 +481,7 @@ pub struct CargoRunnableArgs {
481481
pub struct ShellRunnableArgs {
482482
pub program: String,
483483
pub args: Vec<String>,
484-
pub cwd: PathBuf,
484+
pub cwd: Utf8PathBuf,
485485
}
486486

487487
pub enum RelatedTests {}

docs/dev/lsp-extensions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!---
2-
lsp/ext.rs hash: 954e00b9191a5e7f
2+
lsp/ext.rs hash: e5664ed098043700
33
44
If you need to change the above hash to make the test pass, please check if you
55
need to adjust this doc as well and ping this issue:

0 commit comments

Comments
 (0)