aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorEmil Gardström <[email protected]>2020-07-27 00:49:17 +0100
committerEmil Gardström <[email protected]>2020-07-27 01:23:21 +0100
commit2b8dcc15ac25ec559258b46b9080b7d4c17178a4 (patch)
tree92ac03c6b8c9ad1c62704017c480c509348c8968 /crates
parent8ff40af7286b66294d8b64f0c8fdb3179a84be76 (diff)
add completion for rustc lints
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide/src/completion/complete_attribute.rs282
1 files changed, 278 insertions, 4 deletions
diff --git a/crates/ra_ide/src/completion/complete_attribute.rs b/crates/ra_ide/src/completion/complete_attribute.rs
index d268c92be..109c5e9a8 100644
--- a/crates/ra_ide/src/completion/complete_attribute.rs
+++ b/crates/ra_ide/src/completion/complete_attribute.rs
@@ -13,13 +13,19 @@ use crate::completion::{
13 13
14pub(super) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { 14pub(super) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> {
15 let attribute = ctx.attribute_under_caret.as_ref()?; 15 let attribute = ctx.attribute_under_caret.as_ref()?;
16
17 match (attribute.path(), attribute.input()) { 16 match (attribute.path(), attribute.input()) {
18 (Some(path), Some(ast::AttrInput::TokenTree(token_tree))) 17 (Some(path), Some(ast::AttrInput::TokenTree(token_tree)))
19 if path.to_string() == "derive" => 18 if path.to_string() == "derive" =>
20 { 19 {
21 complete_derive(acc, ctx, token_tree) 20 complete_derive(acc, ctx, token_tree)
22 } 21 }
22 (Some(path), Some(ast::AttrInput::TokenTree(token_tree)))
23 if ["allow", "warn", "deny", "forbid"]
24 .iter()
25 .any(|lint_level| lint_level == &path.to_string()) =>
26 {
27 complete_lint(acc, ctx, token_tree)
28 }
23 (_, Some(ast::AttrInput::TokenTree(_token_tree))) => {} 29 (_, Some(ast::AttrInput::TokenTree(_token_tree))) => {}
24 _ => complete_attribute_start(acc, ctx, attribute), 30 _ => complete_attribute_start(acc, ctx, attribute),
25 } 31 }
@@ -125,7 +131,7 @@ const ATTRIBUTES: &[AttrCompletion] = &[
125]; 131];
126 132
127fn complete_derive(acc: &mut Completions, ctx: &CompletionContext, derive_input: ast::TokenTree) { 133fn complete_derive(acc: &mut Completions, ctx: &CompletionContext, derive_input: ast::TokenTree) {
128 if let Ok(existing_derives) = parse_derive_input(derive_input) { 134 if let Ok(existing_derives) = parse_comma_sep_input(derive_input) {
129 for derive_completion in DEFAULT_DERIVE_COMPLETIONS 135 for derive_completion in DEFAULT_DERIVE_COMPLETIONS
130 .into_iter() 136 .into_iter()
131 .filter(|completion| !existing_derives.contains(completion.label)) 137 .filter(|completion| !existing_derives.contains(completion.label))
@@ -158,7 +164,26 @@ fn complete_derive(acc: &mut Completions, ctx: &CompletionContext, derive_input:
158 } 164 }
159} 165}
160 166
161fn parse_derive_input(derive_input: ast::TokenTree) -> Result<FxHashSet<String>, ()> { 167fn complete_lint(acc: &mut Completions, ctx: &CompletionContext, derive_input: ast::TokenTree) {
168 if let Ok(existing_lints) = parse_comma_sep_input(derive_input) {
169 for lint_completion in DEFAULT_LINT_COMPLETIONS
170 .into_iter()
171 .filter(|completion| !existing_lints.contains(completion.label))
172 {
173 acc.add(
174 CompletionItem::new(
175 CompletionKind::Attribute,
176 ctx.source_range(),
177 lint_completion.label,
178 )
179 .kind(CompletionItemKind::Attribute)
180 .detail(lint_completion.description),
181 );
182 }
183 }
184}
185
186fn parse_comma_sep_input(derive_input: ast::TokenTree) -> Result<FxHashSet<String>, ()> {
162 match (derive_input.left_delimiter_token(), derive_input.right_delimiter_token()) { 187 match (derive_input.left_delimiter_token(), derive_input.right_delimiter_token()) {
163 (Some(left_paren), Some(right_paren)) 188 (Some(left_paren), Some(right_paren))
164 if left_paren.kind() == SyntaxKind::L_PAREN 189 if left_paren.kind() == SyntaxKind::L_PAREN
@@ -212,6 +237,7 @@ struct DeriveCompletion {
212 237
213/// Standard Rust derives and the information about their dependencies 238/// Standard Rust derives and the information about their dependencies
214/// (the dependencies are needed so that the main derive don't break the compilation when added) 239/// (the dependencies are needed so that the main derive don't break the compilation when added)
240#[rustfmt::skip]
215const DEFAULT_DERIVE_COMPLETIONS: &[DeriveCompletion] = &[ 241const DEFAULT_DERIVE_COMPLETIONS: &[DeriveCompletion] = &[
216 DeriveCompletion { label: "Clone", dependencies: &[] }, 242 DeriveCompletion { label: "Clone", dependencies: &[] },
217 DeriveCompletion { label: "Copy", dependencies: &["Clone"] }, 243 DeriveCompletion { label: "Copy", dependencies: &["Clone"] },
@@ -224,6 +250,130 @@ const DEFAULT_DERIVE_COMPLETIONS: &[DeriveCompletion] = &[
224 DeriveCompletion { label: "Ord", dependencies: &["PartialOrd", "Eq", "PartialEq"] }, 250 DeriveCompletion { label: "Ord", dependencies: &["PartialOrd", "Eq", "PartialEq"] },
225]; 251];
226 252
253struct LintCompletion {
254 label: &'static str,
255 description: &'static str,
256}
257
258#[rustfmt::skip]
259const DEFAULT_LINT_COMPLETIONS: &[LintCompletion] = &[
260 LintCompletion { label: "absolute_paths_not_starting_with_crate", description: r#"fully qualified paths that start with a module name instead of `crate`, `self`, or an extern crate name"# },
261 LintCompletion { label: "anonymous_parameters", description: r#"detects anonymous parameters"# },
262 LintCompletion { label: "box_pointers", description: r#"use of owned (Box type) heap memory"# },
263 LintCompletion { label: "deprecated_in_future", description: r#"detects use of items that will be deprecated in a future version"# },
264 LintCompletion { label: "elided_lifetimes_in_paths", description: r#"hidden lifetime parameters in types are deprecated"# },
265 LintCompletion { label: "explicit_outlives_requirements", description: r#"outlives requirements can be inferred"# },
266 LintCompletion { label: "indirect_structural_match", description: r#"pattern with const indirectly referencing non-structural-match type"# },
267 LintCompletion { label: "keyword_idents", description: r#"detects edition keywords being used as an identifier"# },
268 LintCompletion { label: "macro_use_extern_crate", description: r#"the `#[macro_use]` attribute is now deprecated in favor of using macros via the module system"# },
269 LintCompletion { label: "meta_variable_misuse", description: r#"possible meta-variable misuse at macro definition"# },
270 LintCompletion { label: "missing_copy_implementations", description: r#"detects potentially-forgotten implementations of `Copy`"# },
271 LintCompletion { label: "missing_crate_level_docs", description: r#"detects crates with no crate-level documentation"# },
272 LintCompletion { label: "missing_debug_implementations", description: r#"detects missing implementations of Debug"# },
273 LintCompletion { label: "missing_docs", description: r#"detects missing documentation for public members"# },
274 LintCompletion { label: "missing_doc_code_examples", description: r#"detects publicly-exported items without code samples in their documentation"# },
275 LintCompletion { label: "non_ascii_idents", description: r#"detects non-ASCII identifiers"# },
276 LintCompletion { label: "private_doc_tests", description: r#"detects code samples in docs of private items not documented by rustdoc"# },
277 LintCompletion { label: "single_use_lifetimes", description: r#"detects lifetime parameters that are only used once"# },
278 LintCompletion { label: "trivial_casts", description: r#"detects trivial casts which could be removed"# },
279 LintCompletion { label: "trivial_numeric_casts", description: r#"detects trivial casts of numeric types which could be removed"# },
280 LintCompletion { label: "unaligned_references", description: r#"detects unaligned references to fields of packed structs"# },
281 LintCompletion { label: "unreachable_pub", description: r#"`pub` items not reachable from crate root"# },
282 LintCompletion { label: "unsafe_code", description: r#"usage of `unsafe` code"# },
283 LintCompletion { label: "unsafe_op_in_unsafe_fn", description: r#"unsafe operations in unsafe functions without an explicit unsafe block are deprecated"# },
284 LintCompletion { label: "unstable_features", description: r#"enabling unstable features (deprecated. do not use)"# },
285 LintCompletion { label: "unused_crate_dependencies", description: r#"crate dependencies that are never used"# },
286 LintCompletion { label: "unused_extern_crates", description: r#"extern crates that are never used"# },
287 LintCompletion { label: "unused_import_braces", description: r#"unnecessary braces around an imported item"# },
288 LintCompletion { label: "unused_lifetimes", description: r#"detects lifetime parameters that are never used"# },
289 LintCompletion { label: "unused_qualifications", description: r#"detects unnecessarily qualified names"# },
290 LintCompletion { label: "unused_results", description: r#"unused result of an expression in a statement"# },
291 LintCompletion { label: "variant_size_differences", description: r#"detects enums with widely varying variant sizes"# },
292 LintCompletion { label: "array_into_iter", description: r#"detects calling `into_iter` on arrays"# },
293 LintCompletion { label: "asm_sub_register", description: r#"using only a subset of a register for inline asm inputs"# },
294 LintCompletion { label: "bare_trait_objects", description: r#"suggest using `dyn Trait` for trait objects"# },
295 LintCompletion { label: "bindings_with_variant_name", description: r#"detects pattern bindings with the same name as one of the matched variants"# },
296 LintCompletion { label: "cenum_impl_drop_cast", description: r#"a C-like enum implementing Drop is cast"# },
297 LintCompletion { label: "clashing_extern_declarations", description: r#"detects when an extern fn has been declared with the same name but different types"# },
298 LintCompletion { label: "coherence_leak_check", description: r#"distinct impls distinguished only by the leak-check code"# },
299 LintCompletion { label: "confusable_idents", description: r#"detects visually confusable pairs between identifiers"# },
300 LintCompletion { label: "dead_code", description: r#"detect unused, unexported items"# },
301 LintCompletion { label: "deprecated", description: r#"detects use of deprecated items"# },
302 LintCompletion { label: "ellipsis_inclusive_range_patterns", description: r#"`...` range patterns are deprecated"# },
303 LintCompletion { label: "exported_private_dependencies", description: r#"public interface leaks type from a private dependency"# },
304 LintCompletion { label: "illegal_floating_point_literal_pattern", description: r#"floating-point literals cannot be used in patterns"# },
305 LintCompletion { label: "improper_ctypes", description: r#"proper use of libc types in foreign modules"# },
306 LintCompletion { label: "improper_ctypes_definitions", description: r#"proper use of libc types in foreign item definitions"# },
307 LintCompletion { label: "incomplete_features", description: r#"incomplete features that may function improperly in some or all cases"# },
308 LintCompletion { label: "inline_no_sanitize", description: r#"detects incompatible use of `#[inline(always)]` and `#[no_sanitize(...)]`"# },
309 LintCompletion { label: "intra_doc_link_resolution_failure", description: r#"failures in resolving intra-doc link targets"# },
310 LintCompletion { label: "invalid_codeblock_attributes", description: r#"codeblock attribute looks a lot like a known one"# },
311 LintCompletion { label: "invalid_value", description: r#"an invalid value is being created (such as a NULL reference)"# },
312 LintCompletion { label: "irrefutable_let_patterns", description: r#"detects irrefutable patterns in if-let and while-let statements"# },
313 LintCompletion { label: "late_bound_lifetime_arguments", description: r#"detects generic lifetime arguments in path segments with late bound lifetime parameters"# },
314 LintCompletion { label: "mixed_script_confusables", description: r#"detects Unicode scripts whose mixed script confusables codepoints are solely used"# },
315 LintCompletion { label: "mutable_borrow_reservation_conflict", description: r#"reservation of a two-phased borrow conflicts with other shared borrows"# },
316 LintCompletion { label: "non_camel_case_types", description: r#"types, variants, traits and type parameters should have camel case names"# },
317 LintCompletion { label: "non_shorthand_field_patterns", description: r#"using `Struct { x: x }` instead of `Struct { x }` in a pattern"# },
318 LintCompletion { label: "non_snake_case", description: r#"variables, methods, functions, lifetime parameters and modules should have snake case names"# },
319 LintCompletion { label: "non_upper_case_globals", description: r#"static constants should have uppercase identifiers"# },
320 LintCompletion { label: "no_mangle_generic_items", description: r#"generic items must be mangled"# },
321 LintCompletion { label: "overlapping_patterns", description: r#"detects overlapping patterns"# },
322 LintCompletion { label: "path_statements", description: r#"path statements with no effect"# },
323 LintCompletion { label: "private_in_public", description: r#"detect private items in public interfaces not caught by the old implementation"# },
324 LintCompletion { label: "proc_macro_derive_resolution_fallback", description: r#"detects proc macro derives using inaccessible names from parent modules"# },
325 LintCompletion { label: "redundant_semicolons", description: r#"detects unnecessary trailing semicolons"# },
326 LintCompletion { label: "renamed_and_removed_lints", description: r#"lints that have been renamed or removed"# },
327 LintCompletion { label: "safe_packed_borrows", description: r#"safe borrows of fields of packed structs were erroneously allowed"# },
328 LintCompletion { label: "stable_features", description: r#"stable features found in `#[feature]` directive"# },
329 LintCompletion { label: "trivial_bounds", description: r#"these bounds don't depend on an type parameters"# },
330 LintCompletion { label: "type_alias_bounds", description: r#"bounds in type aliases are not enforced"# },
331 LintCompletion { label: "tyvar_behind_raw_pointer", description: r#"raw pointer to an inference variable"# },
332 LintCompletion { label: "uncommon_codepoints", description: r#"detects uncommon Unicode codepoints in identifiers"# },
333 LintCompletion { label: "unconditional_recursion", description: r#"functions that cannot return without calling themselves"# },
334 LintCompletion { label: "unknown_lints", description: r#"unrecognized lint attribute"# },
335 LintCompletion { label: "unnameable_test_items", description: r#"detects an item that cannot be named being marked as `#[test_case]`"# },
336 LintCompletion { label: "unreachable_code", description: r#"detects unreachable code paths"# },
337 LintCompletion { label: "unreachable_patterns", description: r#"detects unreachable patterns"# },
338 LintCompletion { label: "unstable_name_collisions", description: r#"detects name collision with an existing but unstable method"# },
339 LintCompletion { label: "unused_allocation", description: r#"detects unnecessary allocations that can be eliminated"# },
340 LintCompletion { label: "unused_assignments", description: r#"detect assignments that will never be read"# },
341 LintCompletion { label: "unused_attributes", description: r#"detects attributes that were not used by the compiler"# },
342 LintCompletion { label: "unused_braces", description: r#"unnecessary braces around an expression"# },
343 LintCompletion { label: "unused_comparisons", description: r#"comparisons made useless by limits of the types involved"# },
344 LintCompletion { label: "unused_doc_comments", description: r#"detects doc comments that aren't used by rustdoc"# },
345 LintCompletion { label: "unused_features", description: r#"unused features found in crate-level `#[feature]` directives"# },
346 LintCompletion { label: "unused_imports", description: r#"imports that are never used"# },
347 LintCompletion { label: "unused_labels", description: r#"detects labels that are never used"# },
348 LintCompletion { label: "unused_macros", description: r#"detects macros that were not used"# },
349 LintCompletion { label: "unused_must_use", description: r#"unused result of a type flagged as `#[must_use]`"# },
350 LintCompletion { label: "unused_mut", description: r#"detect mut variables which don't need to be mutable"# },
351 LintCompletion { label: "unused_parens", description: r#"`if`, `match`, `while` and `return` do not need parentheses"# },
352 LintCompletion { label: "unused_unsafe", description: r#"unnecessary use of an `unsafe` block"# },
353 LintCompletion { label: "unused_variables", description: r#"detect variables which are not used in any way"# },
354 LintCompletion { label: "warnings", description: r#"mass-change the level for lints which produce warnings"# },
355 LintCompletion { label: "where_clauses_object_safety", description: r#"checks the object safety of where clauses"# },
356 LintCompletion { label: "while_true", description: r#"suggest using `loop { }` instead of `while true { }`"# },
357 LintCompletion { label: "ambiguous_associated_items", description: r#"ambiguous associated items"# },
358 LintCompletion { label: "arithmetic_overflow", description: r#"arithmetic operation overflows"# },
359 LintCompletion { label: "conflicting_repr_hints", description: r#"conflicts between `#[repr(..)]` hints that were previously accepted and used in practice"# },
360 LintCompletion { label: "const_err", description: r#"constant evaluation detected erroneous expression"# },
361 LintCompletion { label: "ill_formed_attribute_input", description: r#"ill-formed attribute inputs that were previously accepted and used in practice"# },
362 LintCompletion { label: "incomplete_include", description: r#"trailing content in included file"# },
363 LintCompletion { label: "invalid_type_param_default", description: r#"type parameter default erroneously allowed in invalid location"# },
364 LintCompletion { label: "macro_expanded_macro_exports_accessed_by_absolute_paths", description: r#"macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths"# },
365 LintCompletion { label: "missing_fragment_specifier", description: r#"detects missing fragment specifiers in unused `macro_rules!` patterns"# },
366 LintCompletion { label: "mutable_transmutes", description: r#"mutating transmuted &mut T from &T may cause undefined behavior"# },
367 LintCompletion { label: "no_mangle_const_items", description: r#"const items will not have their symbols exported"# },
368 LintCompletion { label: "order_dependent_trait_objects", description: r#"trait-object types were treated as different depending on marker-trait order"# },
369 LintCompletion { label: "overflowing_literals", description: r#"literal out of range for its type"# },
370 LintCompletion { label: "patterns_in_fns_without_body", description: r#"patterns in functions without body were erroneously allowed"# },
371 LintCompletion { label: "pub_use_of_private_extern_crate", description: r#"detect public re-exports of private extern crates"# },
372 LintCompletion { label: "soft_unstable", description: r#"a feature gate that doesn't break dependent crates"# },
373 LintCompletion { label: "unconditional_panic", description: r#"operation will cause a panic at runtime"# },
374 LintCompletion { label: "unknown_crate_types", description: r#"unknown crate type found in `#[crate_type]` directive"# },
375];
376
227#[cfg(test)] 377#[cfg(test)]
228mod tests { 378mod tests {
229 use expect::{expect, Expect}; 379 use expect::{expect, Expect};
@@ -257,6 +407,130 @@ struct Test {}
257 } 407 }
258 408
259 #[test] 409 #[test]
410 fn empty_lint_completion() {
411 check(
412 r#"#[allow(<|>)]"#,
413 expect![[r#"
414 at absolute_paths_not_starting_with_crate fully qualified paths that start with a module name instead of `crate`, `self`, or an extern crate name
415 at ambiguous_associated_items ambiguous associated items
416 at anonymous_parameters detects anonymous parameters
417 at arithmetic_overflow arithmetic operation overflows
418 at array_into_iter detects calling `into_iter` on arrays
419 at asm_sub_register using only a subset of a register for inline asm inputs
420 at bare_trait_objects suggest using `dyn Trait` for trait objects
421 at bindings_with_variant_name detects pattern bindings with the same name as one of the matched variants
422 at box_pointers use of owned (Box type) heap memory
423 at cenum_impl_drop_cast a C-like enum implementing Drop is cast
424 at clashing_extern_declarations detects when an extern fn has been declared with the same name but different types
425 at coherence_leak_check distinct impls distinguished only by the leak-check code
426 at conflicting_repr_hints conflicts between `#[repr(..)]` hints that were previously accepted and used in practice
427 at confusable_idents detects visually confusable pairs between identifiers
428 at const_err constant evaluation detected erroneous expression
429 at dead_code detect unused, unexported items
430 at deprecated detects use of deprecated items
431 at deprecated_in_future detects use of items that will be deprecated in a future version
432 at elided_lifetimes_in_paths hidden lifetime parameters in types are deprecated
433 at ellipsis_inclusive_range_patterns `...` range patterns are deprecated
434 at explicit_outlives_requirements outlives requirements can be inferred
435 at exported_private_dependencies public interface leaks type from a private dependency
436 at ill_formed_attribute_input ill-formed attribute inputs that were previously accepted and used in practice
437 at illegal_floating_point_literal_pattern floating-point literals cannot be used in patterns
438 at improper_ctypes proper use of libc types in foreign modules
439 at improper_ctypes_definitions proper use of libc types in foreign item definitions
440 at incomplete_features incomplete features that may function improperly in some or all cases
441 at incomplete_include trailing content in included file
442 at indirect_structural_match pattern with const indirectly referencing non-structural-match type
443 at inline_no_sanitize detects incompatible use of `#[inline(always)]` and `#[no_sanitize(...)]`
444 at intra_doc_link_resolution_failure failures in resolving intra-doc link targets
445 at invalid_codeblock_attributes codeblock attribute looks a lot like a known one
446 at invalid_type_param_default type parameter default erroneously allowed in invalid location
447 at invalid_value an invalid value is being created (such as a NULL reference)
448 at irrefutable_let_patterns detects irrefutable patterns in if-let and while-let statements
449 at keyword_idents detects edition keywords being used as an identifier
450 at late_bound_lifetime_arguments detects generic lifetime arguments in path segments with late bound lifetime parameters
451 at macro_expanded_macro_exports_accessed_by_absolute_paths macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths
452 at macro_use_extern_crate the `#[macro_use]` attribute is now deprecated in favor of using macros via the module system
453 at meta_variable_misuse possible meta-variable misuse at macro definition
454 at missing_copy_implementations detects potentially-forgotten implementations of `Copy`
455 at missing_crate_level_docs detects crates with no crate-level documentation
456 at missing_debug_implementations detects missing implementations of Debug
457 at missing_doc_code_examples detects publicly-exported items without code samples in their documentation
458 at missing_docs detects missing documentation for public members
459 at missing_fragment_specifier detects missing fragment specifiers in unused `macro_rules!` patterns
460 at mixed_script_confusables detects Unicode scripts whose mixed script confusables codepoints are solely used
461 at mutable_borrow_reservation_conflict reservation of a two-phased borrow conflicts with other shared borrows
462 at mutable_transmutes mutating transmuted &mut T from &T may cause undefined behavior
463 at no_mangle_const_items const items will not have their symbols exported
464 at no_mangle_generic_items generic items must be mangled
465 at non_ascii_idents detects non-ASCII identifiers
466 at non_camel_case_types types, variants, traits and type parameters should have camel case names
467 at non_shorthand_field_patterns using `Struct { x: x }` instead of `Struct { x }` in a pattern
468 at non_snake_case variables, methods, functions, lifetime parameters and modules should have snake case names
469 at non_upper_case_globals static constants should have uppercase identifiers
470 at order_dependent_trait_objects trait-object types were treated as different depending on marker-trait order
471 at overflowing_literals literal out of range for its type
472 at overlapping_patterns detects overlapping patterns
473 at path_statements path statements with no effect
474 at patterns_in_fns_without_body patterns in functions without body were erroneously allowed
475 at private_doc_tests detects code samples in docs of private items not documented by rustdoc
476 at private_in_public detect private items in public interfaces not caught by the old implementation
477 at proc_macro_derive_resolution_fallback detects proc macro derives using inaccessible names from parent modules
478 at pub_use_of_private_extern_crate detect public re-exports of private extern crates
479 at redundant_semicolons detects unnecessary trailing semicolons
480 at renamed_and_removed_lints lints that have been renamed or removed
481 at safe_packed_borrows safe borrows of fields of packed structs were erroneously allowed
482 at single_use_lifetimes detects lifetime parameters that are only used once
483 at soft_unstable a feature gate that doesn't break dependent crates
484 at stable_features stable features found in `#[feature]` directive
485 at trivial_bounds these bounds don't depend on an type parameters
486 at trivial_casts detects trivial casts which could be removed
487 at trivial_numeric_casts detects trivial casts of numeric types which could be removed
488 at type_alias_bounds bounds in type aliases are not enforced
489 at tyvar_behind_raw_pointer raw pointer to an inference variable
490 at unaligned_references detects unaligned references to fields of packed structs
491 at uncommon_codepoints detects uncommon Unicode codepoints in identifiers
492 at unconditional_panic operation will cause a panic at runtime
493 at unconditional_recursion functions that cannot return without calling themselves
494 at unknown_crate_types unknown crate type found in `#[crate_type]` directive
495 at unknown_lints unrecognized lint attribute
496 at unnameable_test_items detects an item that cannot be named being marked as `#[test_case]`
497 at unreachable_code detects unreachable code paths
498 at unreachable_patterns detects unreachable patterns
499 at unreachable_pub `pub` items not reachable from crate root
500 at unsafe_code usage of `unsafe` code
501 at unsafe_op_in_unsafe_fn unsafe operations in unsafe functions without an explicit unsafe block are deprecated
502 at unstable_features enabling unstable features (deprecated. do not use)
503 at unstable_name_collisions detects name collision with an existing but unstable method
504 at unused_allocation detects unnecessary allocations that can be eliminated
505 at unused_assignments detect assignments that will never be read
506 at unused_attributes detects attributes that were not used by the compiler
507 at unused_braces unnecessary braces around an expression
508 at unused_comparisons comparisons made useless by limits of the types involved
509 at unused_crate_dependencies crate dependencies that are never used
510 at unused_doc_comments detects doc comments that aren't used by rustdoc
511 at unused_extern_crates extern crates that are never used
512 at unused_features unused features found in crate-level `#[feature]` directives
513 at unused_import_braces unnecessary braces around an imported item
514 at unused_imports imports that are never used
515 at unused_labels detects labels that are never used
516 at unused_lifetimes detects lifetime parameters that are never used
517 at unused_macros detects macros that were not used
518 at unused_must_use unused result of a type flagged as `#[must_use]`
519 at unused_mut detect mut variables which don't need to be mutable
520 at unused_parens `if`, `match`, `while` and `return` do not need parentheses
521 at unused_qualifications detects unnecessarily qualified names
522 at unused_results unused result of an expression in a statement
523 at unused_unsafe unnecessary use of an `unsafe` block
524 at unused_variables detect variables which are not used in any way
525 at variant_size_differences detects enums with widely varying variant sizes
526 at warnings mass-change the level for lints which produce warnings
527 at where_clauses_object_safety checks the object safety of where clauses
528 at while_true suggest using `loop { }` instead of `while true { }`
529 "#]],
530 )
531 }
532
533 #[test]
260 fn no_completion_for_incorrect_derive() { 534 fn no_completion_for_incorrect_derive() {
261 check( 535 check(
262 r#" 536 r#"
@@ -325,7 +599,7 @@ struct Test {}
325 599
326 #[test] 600 #[test]
327 fn test_attribute_completion_inside_nested_attr() { 601 fn test_attribute_completion_inside_nested_attr() {
328 check(r#"#[allow(<|>)]"#, expect![[]]) 602 check(r#"#[cfg(<|>)]"#, expect![[]])
329 } 603 }
330 604
331 #[test] 605 #[test]