mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Formatting
This commit is contained in:
parent
b5e87ac111
commit
2b2b9f8c73
2 changed files with 5 additions and 6 deletions
|
@ -3,7 +3,9 @@ use hir::Semantics;
|
||||||
use ide_db::{syntax_helpers::node_ext::macro_call_for_string_token, RootDatabase};
|
use ide_db::{syntax_helpers::node_ext::macro_call_for_string_token, RootDatabase};
|
||||||
use syntax::ast::{self, IsString};
|
use syntax::ast::{self, IsString};
|
||||||
|
|
||||||
use crate::{context::CompletionContext, CompletionItem, CompletionItemKind, completions::Completions};
|
use crate::{
|
||||||
|
completions::Completions, context::CompletionContext, CompletionItem, CompletionItemKind,
|
||||||
|
};
|
||||||
|
|
||||||
const CARGO_DEFINED_VARS: &[(&str, &str)] = &[
|
const CARGO_DEFINED_VARS: &[(&str, &str)] = &[
|
||||||
("CARGO","Path to the cargo binary performing the build"),
|
("CARGO","Path to the cargo binary performing the build"),
|
||||||
|
@ -44,10 +46,7 @@ pub(crate) fn complete_cargo_env_vars(
|
||||||
Some(())
|
Some(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn guard_env_macro(
|
fn guard_env_macro(string: &ast::String, semantics: &Semantics<'_, RootDatabase>) -> Option<()> {
|
||||||
string: &ast::String,
|
|
||||||
semantics: &Semantics<'_, RootDatabase>,
|
|
||||||
) -> Option<()> {
|
|
||||||
let call = macro_call_for_string_token(string)?;
|
let call = macro_call_for_string_token(string)?;
|
||||||
let name = call.path()?.segment()?.name_ref()?;
|
let name = call.path()?.segment()?.name_ref()?;
|
||||||
let makro = semantics.resolve_macro_call(&call)?;
|
let makro = semantics.resolve_macro_call(&call)?;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
//! Tools to work with format string literals for the `format_args!` family of macros.
|
//! Tools to work with format string literals for the `format_args!` family of macros.
|
||||||
|
use crate::syntax_helpers::node_ext::macro_call_for_string_token;
|
||||||
use syntax::{
|
use syntax::{
|
||||||
ast::{self, IsString},
|
ast::{self, IsString},
|
||||||
TextRange, TextSize,
|
TextRange, TextSize,
|
||||||
};
|
};
|
||||||
use crate::syntax_helpers::node_ext::macro_call_for_string_token;
|
|
||||||
|
|
||||||
pub fn is_format_string(string: &ast::String) -> bool {
|
pub fn is_format_string(string: &ast::String) -> bool {
|
||||||
// Check if `string` is a format string argument of a macro invocation.
|
// Check if `string` is a format string argument of a macro invocation.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue