mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Merge commit 'ddf105b646
' into sync-from-ra
This commit is contained in:
parent
0816d49d83
commit
e41ab350d6
378 changed files with 14720 additions and 3111 deletions
|
@ -322,7 +322,7 @@ impl WorkspaceBuildScripts {
|
|||
let mut deserializer = serde_json::Deserializer::from_str(line);
|
||||
deserializer.disable_recursion_limit();
|
||||
let message = Message::deserialize(&mut deserializer)
|
||||
.unwrap_or_else(|_| Message::TextLine(line.to_string()));
|
||||
.unwrap_or_else(|_| Message::TextLine(line.to_owned()));
|
||||
|
||||
match message {
|
||||
Message::BuildScriptExecuted(mut message) => {
|
||||
|
@ -356,7 +356,7 @@ impl WorkspaceBuildScripts {
|
|||
if let Some(out_dir) =
|
||||
out_dir.as_os_str().to_str().map(|s| s.to_owned())
|
||||
{
|
||||
data.envs.push(("OUT_DIR".to_string(), out_dir));
|
||||
data.envs.push(("OUT_DIR".to_owned(), out_dir));
|
||||
}
|
||||
data.out_dir = Some(out_dir);
|
||||
data.cfgs = cfgs;
|
||||
|
@ -396,7 +396,7 @@ impl WorkspaceBuildScripts {
|
|||
|
||||
let errors = if !output.status.success() {
|
||||
let errors = errors.into_inner();
|
||||
Some(if errors.is_empty() { "cargo check failed".to_string() } else { errors })
|
||||
Some(if errors.is_empty() { "cargo check failed".to_owned() } else { errors })
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
@ -490,7 +490,7 @@ impl WorkspaceBuildScripts {
|
|||
|
||||
// FIXME: Find a better way to know if it is a dylib.
|
||||
fn is_dylib(path: &Utf8Path) -> bool {
|
||||
match path.extension().map(|e| e.to_string().to_lowercase()) {
|
||||
match path.extension().map(|e| e.to_owned().to_lowercase()) {
|
||||
None => false,
|
||||
Some(ext) => matches!(ext.as_str(), "dll" | "dylib" | "so"),
|
||||
}
|
||||
|
|
|
@ -285,7 +285,7 @@ impl CargoWorkspace {
|
|||
// FIXME: Fetching metadata is a slow process, as it might require
|
||||
// calling crates.io. We should be reporting progress here, but it's
|
||||
// unclear whether cargo itself supports it.
|
||||
progress("metadata".to_string());
|
||||
progress("metadata".to_owned());
|
||||
|
||||
(|| -> Result<cargo_metadata::Metadata, cargo_metadata::Error> {
|
||||
let mut command = meta.cargo_command();
|
||||
|
@ -399,7 +399,7 @@ impl CargoWorkspace {
|
|||
CargoWorkspace { packages, targets, workspace_root, target_directory }
|
||||
}
|
||||
|
||||
pub fn packages(&self) -> impl Iterator<Item = Package> + ExactSizeIterator + '_ {
|
||||
pub fn packages(&self) -> impl ExactSizeIterator<Item = Package> + '_ {
|
||||
self.packages.iter().map(|(id, _pkg)| id)
|
||||
}
|
||||
|
||||
|
@ -502,7 +502,7 @@ fn rustc_discover_host_triple(
|
|||
let field = "host: ";
|
||||
let target = stdout.lines().find_map(|l| l.strip_prefix(field));
|
||||
if let Some(target) = target {
|
||||
Some(target.to_string())
|
||||
Some(target.to_owned())
|
||||
} else {
|
||||
// If we fail to resolve the host platform, it's not the end of the world.
|
||||
tracing::info!("rustc -vV did not report host platform, got:\n{}", stdout);
|
||||
|
@ -536,7 +536,7 @@ fn parse_output_cargo_config_build_target(stdout: String) -> Vec<String> {
|
|||
let trimmed = stdout.trim_start_matches("build.target = ").trim_matches('"');
|
||||
|
||||
if !trimmed.starts_with('[') {
|
||||
return [trimmed.to_string()].to_vec();
|
||||
return [trimmed.to_owned()].to_vec();
|
||||
}
|
||||
|
||||
let res = serde_json::from_str(trimmed);
|
||||
|
|
|
@ -19,7 +19,7 @@ impl FromStr for CfgFlag {
|
|||
if !(value.starts_with('"') && value.ends_with('"')) {
|
||||
return Err(format!("Invalid cfg ({s:?}), value should be in quotes"));
|
||||
}
|
||||
let key = key.to_string();
|
||||
let key = key.to_owned();
|
||||
let value = value[1..value.len() - 1].to_string();
|
||||
CfgFlag::KeyValue { key, value }
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ fn utf8_stdout(mut cmd: Command) -> anyhow::Result<String> {
|
|||
}
|
||||
}
|
||||
let stdout = String::from_utf8(output.stdout)?;
|
||||
Ok(stdout.trim().to_string())
|
||||
Ok(stdout.trim().to_owned())
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)]
|
||||
|
|
|
@ -33,7 +33,7 @@ pub(crate) fn get(
|
|||
res.push(CfgFlag::Atom("target_thread_local".into()));
|
||||
for ty in ["8", "16", "32", "64", "cas", "ptr"] {
|
||||
for key in ["target_has_atomic", "target_has_atomic_load_store"] {
|
||||
res.push(CfgFlag::KeyValue { key: key.to_string(), value: ty.into() });
|
||||
res.push(CfgFlag::KeyValue { key: key.to_owned(), value: ty.into() });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ impl Stitched {
|
|||
self.by_name("proc_macro")
|
||||
}
|
||||
|
||||
pub(crate) fn crates(&self) -> impl Iterator<Item = SysrootCrate> + ExactSizeIterator + '_ {
|
||||
pub(crate) fn crates(&self) -> impl ExactSizeIterator<Item = SysrootCrate> + '_ {
|
||||
self.crates.iter().map(|(id, _data)| id)
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ fn get_fake_sysroot() -> Sysroot {
|
|||
}
|
||||
|
||||
fn rooted_project_json(data: ProjectJsonData) -> ProjectJson {
|
||||
let mut root = "$ROOT$".to_string();
|
||||
let mut root = "$ROOT$".to_owned();
|
||||
replace_root(&mut root, true);
|
||||
let path = Path::new(&root);
|
||||
let base = AbsPath::assert(path);
|
||||
|
|
|
@ -241,7 +241,7 @@ impl ProjectWorkspace {
|
|||
.map_err(|p| Some(format!("rustc source path is not absolute: {p}"))),
|
||||
Some(RustLibSource::Discover) => {
|
||||
sysroot.as_ref().ok().and_then(Sysroot::discover_rustc_src).ok_or_else(
|
||||
|| Some("Failed to discover rustc source for sysroot.".to_string()),
|
||||
|| Some("Failed to discover rustc source for sysroot.".to_owned()),
|
||||
)
|
||||
}
|
||||
None => Err(None),
|
||||
|
@ -840,7 +840,7 @@ fn project_json_to_crate_graph(
|
|||
if let Some(name) = display_name.clone() {
|
||||
CrateOrigin::Local {
|
||||
repo: repository.clone(),
|
||||
name: Some(name.canonical_name().to_string()),
|
||||
name: Some(name.canonical_name().to_owned()),
|
||||
}
|
||||
} else {
|
||||
CrateOrigin::Local { repo: None, name: None }
|
||||
|
@ -1117,7 +1117,7 @@ fn detached_files_to_crate_graph(
|
|||
let display_name = detached_file
|
||||
.file_stem()
|
||||
.and_then(|os_str| os_str.to_str())
|
||||
.map(|file_stem| CrateDisplayName::from_canonical_name(file_stem.to_string()));
|
||||
.map(|file_stem| CrateDisplayName::from_canonical_name(file_stem.to_owned()));
|
||||
let detached_file_crate = crate_graph.add_crate_root(
|
||||
file_id,
|
||||
Edition::CURRENT,
|
||||
|
@ -1129,7 +1129,7 @@ fn detached_files_to_crate_graph(
|
|||
false,
|
||||
CrateOrigin::Local {
|
||||
repo: None,
|
||||
name: display_name.map(|n| n.canonical_name().to_string()),
|
||||
name: display_name.map(|n| n.canonical_name().to_owned()),
|
||||
},
|
||||
target_layout.clone(),
|
||||
None,
|
||||
|
@ -1323,7 +1323,7 @@ fn add_target_crate_root(
|
|||
}
|
||||
}
|
||||
|
||||
let display_name = CrateDisplayName::from_canonical_name(cargo_name.to_string());
|
||||
let display_name = CrateDisplayName::from_canonical_name(cargo_name.to_owned());
|
||||
let crate_id = crate_graph.add_crate_root(
|
||||
file_id,
|
||||
edition,
|
||||
|
@ -1455,7 +1455,7 @@ fn sysroot_to_crate_graph(
|
|||
(SysrootPublicDeps { deps: pub_deps }, libproc_macro)
|
||||
}
|
||||
SysrootMode::Stitched(stitched) => {
|
||||
let cfg_options = create_cfg_options(rustc_cfg.clone());
|
||||
let cfg_options = create_cfg_options(rustc_cfg);
|
||||
let sysroot_crates: FxHashMap<SysrootCrate, CrateId> = stitched
|
||||
.crates()
|
||||
.filter_map(|krate| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue