mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Fix code style issues
This commit is contained in:
parent
50a147dcdf
commit
9ea57cac0e
3 changed files with 7 additions and 4 deletions
|
@ -21,7 +21,7 @@ pub fn validate_module_item(
|
||||||
owner: ModuleDefId,
|
owner: ModuleDefId,
|
||||||
sink: &mut DiagnosticSink<'_>,
|
sink: &mut DiagnosticSink<'_>,
|
||||||
) {
|
) {
|
||||||
let _p = profile::span("validate_body");
|
let _p = profile::span("validate_module_item");
|
||||||
let mut validator = decl_check::DeclValidator::new(owner, sink);
|
let mut validator = decl_check::DeclValidator::new(owner, sink);
|
||||||
validator.validate_item(db);
|
validator.validate_item(db);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
//! Provides validators for the item declarations.
|
//! Provides validators for the item declarations.
|
||||||
|
//!
|
||||||
//! This includes the following items:
|
//! This includes the following items:
|
||||||
|
//!
|
||||||
//! - variable bindings (e.g. `let x = foo();`)
|
//! - variable bindings (e.g. `let x = foo();`)
|
||||||
//! - struct fields (e.g. `struct Foo { field: u8 }`)
|
//! - struct fields (e.g. `struct Foo { field: u8 }`)
|
||||||
//! - enum fields (e.g. `enum Foo { Variant { field: u8 } }`)
|
//! - enum variants (e.g. `enum Foo { Variant { field: u8 } }`)
|
||||||
//! - function/method arguments (e.g. `fn foo(arg: u8)`)
|
//! - function/method arguments (e.g. `fn foo(arg: u8)`)
|
||||||
|
//! - constants (e.g. `const FOO: u8 = 10;`)
|
||||||
|
//! - static items (e.g. `static FOO: u8 = 10;`)
|
||||||
|
//! - match arm bindings (e.g. `foo @ Some(_)`)
|
||||||
|
|
||||||
mod str_helpers;
|
mod str_helpers;
|
||||||
|
|
||||||
|
@ -48,7 +53,6 @@ impl<'a, 'b> DeclValidator<'a, 'b> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn validate_item(&mut self, db: &dyn HirDatabase) {
|
pub(super) fn validate_item(&mut self, db: &dyn HirDatabase) {
|
||||||
// let def = self.owner.into();
|
|
||||||
match self.owner {
|
match self.owner {
|
||||||
ModuleDefId::FunctionId(func) => self.validate_func(db, func),
|
ModuleDefId::FunctionId(func) => self.validate_func(db, func),
|
||||||
ModuleDefId::AdtId(adt) => self.validate_adt(db, adt),
|
ModuleDefId::AdtId(adt) => self.validate_adt(db, adt),
|
||||||
|
|
|
@ -135,7 +135,6 @@ fn diagnostic_with_fix<D: DiagnosticWithFix>(d: &D, sema: &Semantics<RootDatabas
|
||||||
|
|
||||||
fn warning_with_fix<D: DiagnosticWithFix>(d: &D, sema: &Semantics<RootDatabase>) -> Diagnostic {
|
fn warning_with_fix<D: DiagnosticWithFix>(d: &D, sema: &Semantics<RootDatabase>) -> Diagnostic {
|
||||||
Diagnostic {
|
Diagnostic {
|
||||||
// name: Some(d.name().into()),
|
|
||||||
range: sema.diagnostics_display_range(d).range,
|
range: sema.diagnostics_display_range(d).range,
|
||||||
message: d.message(),
|
message: d.message(),
|
||||||
severity: Severity::WeakWarning,
|
severity: Severity::WeakWarning,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue