mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 05:38:46 +00:00
Auto merge of #17522 - Veykril:comptimes, r=Veykril
internal: Cut compiletimes slightly
This commit is contained in:
commit
72f278b5be
8 changed files with 106 additions and 115 deletions
39
Cargo.lock
generated
39
Cargo.lock
generated
|
@ -616,7 +616,7 @@ dependencies = [
|
|||
"oorandom",
|
||||
"project-model",
|
||||
"ra-ap-rustc_abi",
|
||||
"ra-ap-rustc_index 0.53.0",
|
||||
"ra-ap-rustc_index",
|
||||
"ra-ap-rustc_pattern_analysis",
|
||||
"rustc-hash",
|
||||
"scoped-tls",
|
||||
|
@ -809,7 +809,6 @@ checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
|
|||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1490,21 +1489,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "80b1d613eee933486c0613a7bc26e515e46f43adf479d1edd5e537f983e9ce46"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"ra-ap-rustc_index 0.53.0",
|
||||
"ra-ap-rustc_index",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_index"
|
||||
version = "0.44.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ad68bacffb87dcdbb23a3ce11261375078aaa06b85d348c49f39ffd5510dc20"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"ra-ap-rustc_index_macros 0.44.0",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_index"
|
||||
version = "0.53.0"
|
||||
|
@ -1512,22 +1500,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "f072060ac77e9e1a02cc20028095993af7e72cc0804779c68bcbf47b16de49c9"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"ra-ap-rustc_index_macros 0.53.0",
|
||||
"ra-ap-rustc_index_macros",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_index_macros"
|
||||
version = "0.44.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8782aaf3a113837c533dfb1c45df91cd17e1fdd1d2f9a20c2e0d1976025c4f1f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_index_macros"
|
||||
version = "0.53.0"
|
||||
|
@ -1556,17 +1532,17 @@ version = "0.53.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70dad7a491c2554590222e0c9212dcb7c2e7aceb668875075012a35ea780d135"
|
||||
dependencies = [
|
||||
"ra-ap-rustc_index 0.53.0",
|
||||
"ra-ap-rustc_index",
|
||||
"ra-ap-rustc_lexer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ra-ap-rustc_pattern_analysis"
|
||||
version = "0.44.0"
|
||||
version = "0.53.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d63d1e1d5b2a13273cee1a10011147418f40e12b70f70578ce1dee0f1cafc334"
|
||||
checksum = "34768e1faf88c31f2e9ad57b48318a52b507dafac0cddbf01b5d63bfc0b0a365"
|
||||
dependencies = [
|
||||
"ra-ap-rustc_index 0.44.0",
|
||||
"ra-ap-rustc_index",
|
||||
"rustc-hash",
|
||||
"rustc_apfloat",
|
||||
"smallvec",
|
||||
|
@ -1683,7 +1659,6 @@ dependencies = [
|
|||
"ide",
|
||||
"ide-db",
|
||||
"ide-ssr",
|
||||
"indexmap",
|
||||
"itertools",
|
||||
"load-cargo",
|
||||
"lsp-server 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
|
@ -87,7 +87,7 @@ ra-ap-rustc_lexer = { version = "0.53.0", default-features = false }
|
|||
ra-ap-rustc_parse_format = { version = "0.53.0", default-features = false }
|
||||
ra-ap-rustc_index = { version = "0.53.0", default-features = false }
|
||||
ra-ap-rustc_abi = { version = "0.53.0", default-features = false }
|
||||
ra-ap-rustc_pattern_analysis = { version = "0.44.0", default-features = false }
|
||||
ra-ap-rustc_pattern_analysis = { version = "0.53.0", default-features = false }
|
||||
|
||||
# local crates that aren't published to crates.io. These should not have versions.
|
||||
sourcegen = { path = "./crates/sourcegen" }
|
||||
|
|
|
@ -51,6 +51,7 @@ pub(crate) struct Pat {
|
|||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub(crate) enum PatKind {
|
||||
Wild,
|
||||
Never,
|
||||
|
||||
/// `x`, `ref x`, `x @ P`, etc.
|
||||
Binding {
|
||||
|
@ -294,6 +295,7 @@ impl HirDisplay for Pat {
|
|||
fn hir_fmt(&self, f: &mut HirFormatter<'_>) -> Result<(), HirDisplayError> {
|
||||
match &*self.kind {
|
||||
PatKind::Wild => write!(f, "_"),
|
||||
PatKind::Never => write!(f, "!"),
|
||||
PatKind::Binding { name, subpattern } => {
|
||||
write!(f, "{}", name.display(f.db.upcast()))?;
|
||||
if let Some(subpattern) = subpattern {
|
||||
|
|
|
@ -4,10 +4,9 @@ use std::fmt;
|
|||
|
||||
use hir_def::{DefWithBodyId, EnumId, EnumVariantId, HasModule, LocalFieldId, ModuleId, VariantId};
|
||||
use once_cell::unsync::Lazy;
|
||||
use rustc_hash::FxHashMap;
|
||||
use rustc_index::IndexVec;
|
||||
use rustc_pattern_analysis::{
|
||||
constructor::{Constructor, ConstructorSet, VariantVisibility},
|
||||
index::IdxContainer,
|
||||
usefulness::{compute_match_usefulness, PlaceValidity, UsefulnessReport},
|
||||
Captures, PatCx, PrivateUninhabitedField,
|
||||
};
|
||||
|
@ -26,10 +25,10 @@ use super::{is_box, FieldPat, Pat, PatKind};
|
|||
use Constructor::*;
|
||||
|
||||
// Re-export r-a-specific versions of all these types.
|
||||
pub(crate) type DeconstructedPat<'p> =
|
||||
rustc_pattern_analysis::pat::DeconstructedPat<MatchCheckCtx<'p>>;
|
||||
pub(crate) type MatchArm<'p> = rustc_pattern_analysis::MatchArm<'p, MatchCheckCtx<'p>>;
|
||||
pub(crate) type WitnessPat<'p> = rustc_pattern_analysis::pat::WitnessPat<MatchCheckCtx<'p>>;
|
||||
pub(crate) type DeconstructedPat<'db> =
|
||||
rustc_pattern_analysis::pat::DeconstructedPat<MatchCheckCtx<'db>>;
|
||||
pub(crate) type MatchArm<'db> = rustc_pattern_analysis::MatchArm<'db, MatchCheckCtx<'db>>;
|
||||
pub(crate) type WitnessPat<'db> = rustc_pattern_analysis::pat::WitnessPat<MatchCheckCtx<'db>>;
|
||||
|
||||
/// [Constructor] uses this in unimplemented variants.
|
||||
/// It allows porting match expressions from upstream algorithm without losing semantics.
|
||||
|
@ -54,23 +53,27 @@ impl EnumVariantContiguousIndex {
|
|||
}
|
||||
}
|
||||
|
||||
impl rustc_index::Idx for EnumVariantContiguousIndex {
|
||||
fn new(idx: usize) -> Self {
|
||||
EnumVariantContiguousIndex(idx)
|
||||
}
|
||||
|
||||
fn index(self) -> usize {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct MatchCheckCtx<'p> {
|
||||
pub(crate) struct MatchCheckCtx<'db> {
|
||||
module: ModuleId,
|
||||
body: DefWithBodyId,
|
||||
pub(crate) db: &'p dyn HirDatabase,
|
||||
pub(crate) db: &'db dyn HirDatabase,
|
||||
exhaustive_patterns: bool,
|
||||
min_exhaustive_patterns: bool,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct PatData<'p> {
|
||||
/// Keep db around so that we can print variant names in `Debug`.
|
||||
pub(crate) db: &'p dyn HirDatabase,
|
||||
}
|
||||
|
||||
impl<'p> MatchCheckCtx<'p> {
|
||||
pub(crate) fn new(module: ModuleId, body: DefWithBodyId, db: &'p dyn HirDatabase) -> Self {
|
||||
impl<'db> MatchCheckCtx<'db> {
|
||||
pub(crate) fn new(module: ModuleId, body: DefWithBodyId, db: &'db dyn HirDatabase) -> Self {
|
||||
let def_map = db.crate_def_map(module.krate());
|
||||
let exhaustive_patterns = def_map.is_unstable_feature_enabled("exhaustive_patterns");
|
||||
let min_exhaustive_patterns =
|
||||
|
@ -80,9 +83,9 @@ impl<'p> MatchCheckCtx<'p> {
|
|||
|
||||
pub(crate) fn compute_match_usefulness(
|
||||
&self,
|
||||
arms: &[MatchArm<'p>],
|
||||
arms: &[MatchArm<'db>],
|
||||
scrut_ty: Ty,
|
||||
) -> Result<UsefulnessReport<'p, Self>, ()> {
|
||||
) -> Result<UsefulnessReport<'db, Self>, ()> {
|
||||
// FIXME: Determine place validity correctly. For now, err on the safe side.
|
||||
let place_validity = PlaceValidity::MaybeInvalid;
|
||||
// Measured to take ~100ms on modern hardware.
|
||||
|
@ -101,7 +104,7 @@ impl<'p> MatchCheckCtx<'p> {
|
|||
}
|
||||
|
||||
fn variant_id_for_adt(
|
||||
db: &'p dyn HirDatabase,
|
||||
db: &'db dyn HirDatabase,
|
||||
ctor: &Constructor<Self>,
|
||||
adt: hir_def::AdtId,
|
||||
) -> Option<VariantId> {
|
||||
|
@ -126,7 +129,7 @@ impl<'p> MatchCheckCtx<'p> {
|
|||
&'a self,
|
||||
ty: &'a Ty,
|
||||
variant: VariantId,
|
||||
) -> impl Iterator<Item = (LocalFieldId, Ty)> + Captures<'a> + Captures<'p> {
|
||||
) -> impl Iterator<Item = (LocalFieldId, Ty)> + Captures<'a> + Captures<'db> {
|
||||
let (_, substs) = ty.as_adt().unwrap();
|
||||
|
||||
let field_tys = self.db.field_types(variant);
|
||||
|
@ -139,8 +142,8 @@ impl<'p> MatchCheckCtx<'p> {
|
|||
})
|
||||
}
|
||||
|
||||
pub(crate) fn lower_pat(&self, pat: &Pat) -> DeconstructedPat<'p> {
|
||||
let singleton = |pat: DeconstructedPat<'p>| vec![pat.at_index(0)];
|
||||
pub(crate) fn lower_pat(&self, pat: &Pat) -> DeconstructedPat<'db> {
|
||||
let singleton = |pat: DeconstructedPat<'db>| vec![pat.at_index(0)];
|
||||
let ctor;
|
||||
let mut fields: Vec<_>;
|
||||
let arity;
|
||||
|
@ -228,6 +231,11 @@ impl<'p> MatchCheckCtx<'p> {
|
|||
fields = Vec::new();
|
||||
arity = 0;
|
||||
}
|
||||
PatKind::Never => {
|
||||
ctor = Never;
|
||||
fields = Vec::new();
|
||||
arity = 0;
|
||||
}
|
||||
PatKind::Or { pats } => {
|
||||
ctor = Or;
|
||||
fields = pats
|
||||
|
@ -238,11 +246,10 @@ impl<'p> MatchCheckCtx<'p> {
|
|||
arity = pats.len();
|
||||
}
|
||||
}
|
||||
let data = PatData { db: self.db };
|
||||
DeconstructedPat::new(ctor, fields, arity, pat.ty.clone(), data)
|
||||
DeconstructedPat::new(ctor, fields, arity, pat.ty.clone(), ())
|
||||
}
|
||||
|
||||
pub(crate) fn hoist_witness_pat(&self, pat: &WitnessPat<'p>) -> Pat {
|
||||
pub(crate) fn hoist_witness_pat(&self, pat: &WitnessPat<'db>) -> Pat {
|
||||
let mut subpatterns = pat.iter_fields().map(|p| self.hoist_witness_pat(p));
|
||||
let kind = match pat.ctor() {
|
||||
&Bool(value) => PatKind::LiteralBool { value },
|
||||
|
@ -290,6 +297,7 @@ impl<'p> MatchCheckCtx<'p> {
|
|||
Slice(_) => unimplemented!(),
|
||||
&Str(void) => match void {},
|
||||
Wildcard | NonExhaustive | Hidden | PrivateUninhabited => PatKind::Wild,
|
||||
Never => PatKind::Never,
|
||||
Missing | F32Range(..) | F64Range(..) | Opaque(..) | Or => {
|
||||
never!("can't convert to pattern: {:?}", pat.ctor());
|
||||
PatKind::Wild
|
||||
|
@ -299,13 +307,13 @@ impl<'p> MatchCheckCtx<'p> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'p> PatCx for MatchCheckCtx<'p> {
|
||||
impl<'db> PatCx for MatchCheckCtx<'db> {
|
||||
type Error = ();
|
||||
type Ty = Ty;
|
||||
type VariantIdx = EnumVariantContiguousIndex;
|
||||
type StrLit = Void;
|
||||
type ArmData = ();
|
||||
type PatData = PatData<'p>;
|
||||
type PatData = ();
|
||||
|
||||
fn is_exhaustive_patterns_feature_on(&self) -> bool {
|
||||
self.exhaustive_patterns
|
||||
|
@ -339,8 +347,8 @@ impl<'p> PatCx for MatchCheckCtx<'p> {
|
|||
},
|
||||
Ref => 1,
|
||||
Slice(..) => unimplemented!(),
|
||||
Bool(..) | IntRange(..) | F32Range(..) | F64Range(..) | Str(..) | Opaque(..)
|
||||
| NonExhaustive | PrivateUninhabited | Hidden | Missing | Wildcard => 0,
|
||||
Never | Bool(..) | IntRange(..) | F32Range(..) | F64Range(..) | Str(..)
|
||||
| Opaque(..) | NonExhaustive | PrivateUninhabited | Hidden | Missing | Wildcard => 0,
|
||||
Or => {
|
||||
never!("The `Or` constructor doesn't have a fixed arity");
|
||||
0
|
||||
|
@ -402,8 +410,10 @@ impl<'p> PatCx for MatchCheckCtx<'p> {
|
|||
}
|
||||
},
|
||||
Slice(_) => unreachable!("Found a `Slice` constructor in match checking"),
|
||||
Bool(..) | IntRange(..) | F32Range(..) | F64Range(..) | Str(..) | Opaque(..)
|
||||
| NonExhaustive | PrivateUninhabited | Hidden | Missing | Wildcard => smallvec![],
|
||||
Never | Bool(..) | IntRange(..) | F32Range(..) | F64Range(..) | Str(..)
|
||||
| Opaque(..) | NonExhaustive | PrivateUninhabited | Hidden | Missing | Wildcard => {
|
||||
smallvec![]
|
||||
}
|
||||
Or => {
|
||||
never!("called `Fields::wildcards` on an `Or` ctor");
|
||||
smallvec![]
|
||||
|
@ -442,11 +452,8 @@ impl<'p> PatCx for MatchCheckCtx<'p> {
|
|||
if enum_data.variants.is_empty() && !is_declared_nonexhaustive {
|
||||
ConstructorSet::NoConstructors
|
||||
} else {
|
||||
let mut variants = FxHashMap::with_capacity_and_hasher(
|
||||
enum_data.variants.len(),
|
||||
Default::default(),
|
||||
);
|
||||
for (i, &(variant, _)) in enum_data.variants.iter().enumerate() {
|
||||
let mut variants = IndexVec::with_capacity(enum_data.variants.len());
|
||||
for &(variant, _) in enum_data.variants.iter() {
|
||||
let is_uninhabited =
|
||||
is_enum_variant_uninhabited_from(cx.db, variant, subst, cx.module);
|
||||
let visibility = if is_uninhabited {
|
||||
|
@ -454,13 +461,10 @@ impl<'p> PatCx for MatchCheckCtx<'p> {
|
|||
} else {
|
||||
VariantVisibility::Visible
|
||||
};
|
||||
variants.insert(EnumVariantContiguousIndex(i), visibility);
|
||||
variants.push(visibility);
|
||||
}
|
||||
|
||||
ConstructorSet::Variants {
|
||||
variants: IdxContainer(variants),
|
||||
non_exhaustive: is_declared_nonexhaustive,
|
||||
}
|
||||
ConstructorSet::Variants { variants, non_exhaustive: is_declared_nonexhaustive }
|
||||
}
|
||||
}
|
||||
TyKind::Adt(AdtId(hir_def::AdtId::UnionId(_)), _) => ConstructorSet::Union,
|
||||
|
@ -476,26 +480,27 @@ impl<'p> PatCx for MatchCheckCtx<'p> {
|
|||
|
||||
fn write_variant_name(
|
||||
f: &mut fmt::Formatter<'_>,
|
||||
pat: &rustc_pattern_analysis::pat::DeconstructedPat<Self>,
|
||||
_ctor: &Constructor<Self>,
|
||||
_ty: &Self::Ty,
|
||||
) -> fmt::Result {
|
||||
let db = pat.data().db;
|
||||
let variant =
|
||||
pat.ty().as_adt().and_then(|(adt, _)| Self::variant_id_for_adt(db, pat.ctor(), adt));
|
||||
write!(f, "<write_variant_name unsupported>")
|
||||
// We lack the database here ...
|
||||
// let variant = ty.as_adt().and_then(|(adt, _)| Self::variant_id_for_adt(db, ctor, adt));
|
||||
|
||||
if let Some(variant) = variant {
|
||||
match variant {
|
||||
VariantId::EnumVariantId(v) => {
|
||||
write!(f, "{}", db.enum_variant_data(v).name.display(db.upcast()))?;
|
||||
}
|
||||
VariantId::StructId(s) => {
|
||||
write!(f, "{}", db.struct_data(s).name.display(db.upcast()))?
|
||||
}
|
||||
VariantId::UnionId(u) => {
|
||||
write!(f, "{}", db.union_data(u).name.display(db.upcast()))?
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
// if let Some(variant) = variant {
|
||||
// match variant {
|
||||
// VariantId::EnumVariantId(v) => {
|
||||
// write!(f, "{}", db.enum_variant_data(v).name.display(db.upcast()))?;
|
||||
// }
|
||||
// VariantId::StructId(s) => {
|
||||
// write!(f, "{}", db.struct_data(s).name.display(db.upcast()))?
|
||||
// }
|
||||
// VariantId::UnionId(u) => {
|
||||
// write!(f, "{}", db.union_data(u).name.display(db.upcast()))?
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// Ok(())
|
||||
}
|
||||
|
||||
fn bug(&self, fmt: fmt::Arguments<'_>) {
|
||||
|
@ -507,7 +512,7 @@ impl<'p> PatCx for MatchCheckCtx<'p> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'p> fmt::Debug for MatchCheckCtx<'p> {
|
||||
impl<'db> fmt::Debug for MatchCheckCtx<'db> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("MatchCheckCtx").finish()
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ always-assert = "0.2.0"
|
|||
walkdir = "2.3.2"
|
||||
semver.workspace = true
|
||||
memchr = "2.7.1"
|
||||
indexmap = { workspace = true, features = ["serde"] }
|
||||
|
||||
cfg.workspace = true
|
||||
flycheck.workspace = true
|
||||
|
|
|
@ -18,7 +18,6 @@ use ide_db::{
|
|||
imports::insert_use::{ImportGranularity, InsertUseConfig, PrefixKind},
|
||||
SnippetCap,
|
||||
};
|
||||
use indexmap::IndexMap;
|
||||
use itertools::Itertools;
|
||||
use lsp_types::{ClientCapabilities, MarkupKind};
|
||||
use paths::{Utf8Path, Utf8PathBuf};
|
||||
|
@ -384,8 +383,7 @@ config_data! {
|
|||
/// Enables completions of private items and fields that are defined in the current workspace even if they are not visible at the current position.
|
||||
completion_privateEditable_enable: bool = false,
|
||||
/// Custom completion snippets.
|
||||
// NOTE: we use IndexMap for deterministic serialization ordering
|
||||
completion_snippets_custom: IndexMap<String, SnippetDef> = serde_json::from_str(r#"{
|
||||
completion_snippets_custom: FxHashMap<String, SnippetDef> = serde_json::from_str(r#"{
|
||||
"Arc::new": {
|
||||
"postfix": "arc",
|
||||
"body": "Arc::new(${receiver})",
|
||||
|
@ -1245,7 +1243,19 @@ impl Config {
|
|||
}
|
||||
|
||||
pub fn json_schema() -> serde_json::Value {
|
||||
FullConfigInput::json_schema()
|
||||
let mut s = FullConfigInput::json_schema();
|
||||
|
||||
fn sort_objects_by_field(json: &mut serde_json::Value) {
|
||||
if let serde_json::Value::Object(object) = json {
|
||||
let old = std::mem::take(object);
|
||||
old.into_iter().sorted_by(|(k, _), (k2, _)| k.cmp(k2)).for_each(|(k, mut v)| {
|
||||
sort_objects_by_field(&mut v);
|
||||
object.insert(k, v);
|
||||
});
|
||||
}
|
||||
}
|
||||
sort_objects_by_field(&mut s);
|
||||
s
|
||||
}
|
||||
|
||||
pub fn root_path(&self) -> &AbsPathBuf {
|
||||
|
@ -2644,9 +2654,8 @@ macro_rules! _config_data {
|
|||
|
||||
/// All fields `Option<T>`, `None` representing fields not set in a particular JSON/TOML blob.
|
||||
#[allow(non_snake_case)]
|
||||
#[derive(Clone, Serialize, Default)]
|
||||
#[derive(Clone, Default)]
|
||||
struct $input { $(
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
$field: Option<$ty>,
|
||||
)* }
|
||||
|
||||
|
@ -2729,7 +2738,7 @@ struct DefaultConfigData {
|
|||
/// All of the config levels, all fields `Option<T>`, to describe fields that are actually set by
|
||||
/// some rust-analyzer.toml file or JSON blob. An empty rust-analyzer.toml corresponds to
|
||||
/// all fields being None.
|
||||
#[derive(Debug, Clone, Default, Serialize)]
|
||||
#[derive(Debug, Clone, Default)]
|
||||
struct FullConfigInput {
|
||||
global: GlobalConfigInput,
|
||||
local: LocalConfigInput,
|
||||
|
@ -2774,7 +2783,7 @@ impl FullConfigInput {
|
|||
/// All of the config levels, all fields `Option<T>`, to describe fields that are actually set by
|
||||
/// some rust-analyzer.toml file or JSON blob. An empty rust-analyzer.toml corresponds to
|
||||
/// all fields being None.
|
||||
#[derive(Debug, Clone, Default, Serialize)]
|
||||
#[derive(Debug, Clone, Default)]
|
||||
struct GlobalLocalConfigInput {
|
||||
global: GlobalConfigInput,
|
||||
local: LocalConfigInput,
|
||||
|
@ -2936,7 +2945,7 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
|
|||
"FxHashMap<Box<str>, Box<[Box<str>]>>" => set! {
|
||||
"type": "object",
|
||||
},
|
||||
"IndexMap<String, SnippetDef>" => set! {
|
||||
"FxHashMap<String, SnippetDef>" => set! {
|
||||
"type": "object",
|
||||
},
|
||||
"FxHashMap<String, String>" => set! {
|
||||
|
@ -3351,6 +3360,7 @@ mod tests {
|
|||
#[test]
|
||||
fn generate_package_json_config() {
|
||||
let s = Config::json_schema();
|
||||
|
||||
let schema = format!("{s:#}");
|
||||
let mut schema = schema
|
||||
.trim_start_matches('[')
|
||||
|
|
|
@ -355,12 +355,6 @@ Default:
|
|||
"description": "Put the expression into a pinned `Box`",
|
||||
"scope": "expr"
|
||||
},
|
||||
"Ok": {
|
||||
"postfix": "ok",
|
||||
"body": "Ok(${receiver})",
|
||||
"description": "Wrap the expression in a `Result::Ok`",
|
||||
"scope": "expr"
|
||||
},
|
||||
"Err": {
|
||||
"postfix": "err",
|
||||
"body": "Err(${receiver})",
|
||||
|
@ -372,6 +366,12 @@ Default:
|
|||
"body": "Some(${receiver})",
|
||||
"description": "Wrap the expression in an `Option::Some`",
|
||||
"scope": "expr"
|
||||
},
|
||||
"Ok": {
|
||||
"postfix": "ok",
|
||||
"body": "Ok(${receiver})",
|
||||
"description": "Wrap the expression in a `Result::Ok`",
|
||||
"scope": "expr"
|
||||
}
|
||||
}
|
||||
----
|
||||
|
|
|
@ -1197,12 +1197,6 @@
|
|||
"description": "Put the expression into a pinned `Box`",
|
||||
"scope": "expr"
|
||||
},
|
||||
"Ok": {
|
||||
"postfix": "ok",
|
||||
"body": "Ok(${receiver})",
|
||||
"description": "Wrap the expression in a `Result::Ok`",
|
||||
"scope": "expr"
|
||||
},
|
||||
"Err": {
|
||||
"postfix": "err",
|
||||
"body": "Err(${receiver})",
|
||||
|
@ -1214,6 +1208,12 @@
|
|||
"body": "Some(${receiver})",
|
||||
"description": "Wrap the expression in an `Option::Some`",
|
||||
"scope": "expr"
|
||||
},
|
||||
"Ok": {
|
||||
"postfix": "ok",
|
||||
"body": "Ok(${receiver})",
|
||||
"description": "Wrap the expression in a `Result::Ok`",
|
||||
"scope": "expr"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
|
|
Loading…
Reference in a new issue