Re-order mod declarations

This commit is contained in:
Lukas Wirth 2024-01-26 20:08:10 +01:00
parent 6cf7b5f8d7
commit 8a5829cf28
40 changed files with 124 additions and 123 deletions

View file

@ -2,8 +2,8 @@
#![warn(rust_2018_idioms, unused_lifetimes)]
mod input;
mod change;
mod input;
use std::panic;

View file

@ -1,10 +1,10 @@
//! Defines `Body`: a lowered representation of bodies of functions, statics and
//! consts.
mod lower;
mod pretty;
pub mod scope;
#[cfg(test)]
mod tests;
pub mod scope;
mod pretty;
use std::ops::Index;

View file

@ -12,8 +12,8 @@
//!
//! See also a neighboring `body` module.
pub mod type_ref;
pub mod format_args;
pub mod type_ref;
use std::fmt;

View file

@ -1,11 +1,11 @@
//! Tests specific to declarative macros, aka macros by example. This covers
//! both stable `macro_rules!` macros as well as unstable `macro` macros.
mod tt_conversion;
mod matching;
mod meta_syntax;
mod metavar_expr;
mod regression;
mod tt_conversion;
use expect_test::expect;

View file

@ -9,9 +9,9 @@
//! write unit-tests (in fact, we used to do that), but that makes tests brittle
//! and harder to understand.
mod mbe;
mod builtin_fn_macro;
mod builtin_derive_macro;
mod builtin_fn_macro;
mod mbe;
mod proc_macros;
use std::{iter, ops::Range, sync};

View file

@ -48,11 +48,11 @@
//! the result
pub mod attr_resolution;
pub mod proc_macro;
pub mod diagnostics;
mod collector;
pub mod diagnostics;
mod mod_resolution;
mod path_resolution;
pub mod proc_macro;
#[cfg(test)]
mod tests;

View file

@ -1,3 +1,4 @@
//! Compiled declarative macro expanders (`macro_rules!`` and `macro`)
use std::sync::OnceLock;
use base_db::{CrateId, Edition, VersionReq};

View file

@ -1,8 +1,8 @@
//! Type inference-based diagnostics.
mod decl_check;
mod expr;
mod match_check;
mod unsafe_check;
mod decl_check;
pub use crate::diagnostics::{
decl_check::{incorrect_case, CaseType, IncorrectCase},

View file

@ -41,10 +41,10 @@ pub mod mir;
pub mod primitive;
pub mod traits;
#[cfg(test)]
mod tests;
#[cfg(test)]
mod test_db;
#[cfg(test)]
mod tests;
use std::{
collections::hash_map::Entry,

View file

@ -21,11 +21,11 @@ use hir_def::{
};
use la_arena::{Arena, ArenaMap, Idx, RawIdx};
mod borrowck;
mod eval;
mod lower;
mod borrowck;
mod pretty;
mod monomorphization;
mod pretty;
pub use borrowck::{borrowck_query, BorrowckResult, MutabilityReason};
pub use eval::{

View file

@ -1,14 +1,14 @@
mod never_type;
mod coercion;
mod regression;
mod simple;
mod patterns;
mod traits;
mod method_resolution;
mod macros;
mod diagnostics;
mod display_source_code;
mod incremental;
mod diagnostics;
mod macros;
mod method_resolution;
mod never_type;
mod patterns;
mod regression;
mod simple;
mod traits;
use std::{collections::HashMap, env};

View file

@ -111,6 +111,8 @@ mod handlers {
mod add_label_to_loop;
mod add_lifetime_to_type;
mod add_missing_impl_members;
mod add_missing_match_arms;
mod add_return_type;
mod add_turbo_fish;
mod apply_demorgan;
mod auto_import;
@ -124,15 +126,15 @@ mod handlers {
mod convert_iter_for_each_to_for;
mod convert_let_else_to_match;
mod convert_match_to_let_else;
mod convert_named_struct_to_tuple_struct;
mod convert_nested_function_to_closure;
mod convert_to_guarded_return;
mod convert_tuple_return_type_to_struct;
mod convert_tuple_struct_to_named_struct;
mod convert_named_struct_to_tuple_struct;
mod convert_to_guarded_return;
mod convert_two_arm_bool_match_to_matches_macro;
mod convert_while_to_loop;
mod desugar_doc_comment;
mod destructure_tuple_binding;
mod desugar_doc_comment;
mod expand_glob_import;
mod extract_expressions_from_format_string;
mod extract_function;
@ -140,7 +142,6 @@ mod handlers {
mod extract_struct_from_enum_variant;
mod extract_type_alias;
mod extract_variable;
mod add_missing_match_arms;
mod fix_visibility;
mod flip_binexpr;
mod flip_comma;
@ -148,6 +149,7 @@ mod handlers {
mod generate_constant;
mod generate_default_from_enum_variant;
mod generate_default_from_new;
mod generate_delegate_methods;
mod generate_delegate_trait;
mod generate_deref;
mod generate_derive;
@ -162,62 +164,60 @@ mod handlers {
mod generate_is_empty_from_len;
mod generate_mut_trait_impl;
mod generate_new;
mod generate_delegate_methods;
mod generate_trait_from_impl;
mod add_return_type;
mod inline_call;
mod inline_const_as_literal;
mod inline_local_variable;
mod inline_macro;
mod inline_type_alias;
mod into_to_qualified_from;
mod introduce_named_generic;
mod introduce_named_lifetime;
mod invert_if;
mod merge_imports;
mod merge_match_arms;
mod merge_nested_if;
mod move_bounds;
mod move_const_to_impl;
mod move_from_mod_rs;
mod move_guard;
mod move_module_to_file;
mod move_to_mod_rs;
mod move_from_mod_rs;
mod number_representation;
mod promote_local_to_const;
mod pull_assignment_up;
mod qualify_path;
mod qualify_method_call;
mod qualify_path;
mod raw_string;
mod remove_dbg;
mod remove_mut;
mod remove_parentheses;
mod remove_unused_imports;
mod remove_unused_param;
mod remove_parentheses;
mod reorder_fields;
mod reorder_impl_items;
mod replace_try_expr_with_match;
mod replace_arith_op;
mod replace_derive_with_manual_impl;
mod replace_if_let_with_match;
mod replace_is_method_with_if_let_method;
mod replace_method_eager_lazy;
mod replace_arith_op;
mod introduce_named_generic;
mod replace_let_with_if_let;
mod replace_method_eager_lazy;
mod replace_named_generic_with_impl;
mod replace_qualified_name_with_use;
mod replace_string_with_char;
mod replace_try_expr_with_match;
mod replace_turbofish_with_explicit_type;
mod split_import;
mod unmerge_match_arm;
mod unwrap_tuple;
mod sort_items;
mod split_import;
mod toggle_ignore;
mod unmerge_match_arm;
mod unmerge_use;
mod unnecessary_async;
mod unqualify_method_call;
mod unwrap_block;
mod unwrap_result_return_type;
mod unqualify_method_call;
mod unwrap_tuple;
mod wrap_return_type_in_result;
mod into_to_qualified_from;
mod merge_nested_if;
pub(crate) fn all() -> &'static [Handler] {
&[

View file

@ -23,8 +23,8 @@ use syntax::{
use crate::assist_context::{AssistContext, SourceChangeBuilder};
pub(crate) mod suggest_name;
mod gen_trait_fn_body;
pub(crate) mod suggest_name;
pub(crate) fn unwrap_trivial_block(block_expr: ast::BlockExpr) -> ast::Expr {
extract_trivial_expression(&block_expr)

View file

@ -2,8 +2,10 @@
pub(crate) mod attribute;
pub(crate) mod dot;
pub(crate) mod env_vars;
pub(crate) mod expr;
pub(crate) mod extern_abi;
pub(crate) mod extern_crate;
pub(crate) mod field;
pub(crate) mod flyimport;
pub(crate) mod fn_param;
@ -19,8 +21,6 @@ pub(crate) mod snippet;
pub(crate) mod r#type;
pub(crate) mod use_;
pub(crate) mod vis;
pub(crate) mod env_vars;
pub(crate) mod extern_crate;
use std::iter;

View file

@ -25,8 +25,8 @@ use crate::{
mod cfg;
mod derive;
mod lint;
mod repr;
mod macro_use;
mod repr;
pub(crate) use self::derive::complete_derive_path;

View file

@ -8,9 +8,9 @@ mod context;
mod item;
mod render;
mod snippet;
#[cfg(test)]
mod tests;
mod snippet;
use ide_db::{
base_db::FilePosition,

View file

@ -1,14 +1,14 @@
//! `render` module provides utilities for rendering completion suggestions
//! into code pieces that will be presented to user.
pub(crate) mod macro_;
pub(crate) mod function;
pub(crate) mod const_;
pub(crate) mod function;
pub(crate) mod literal;
pub(crate) mod macro_;
pub(crate) mod pattern;
pub(crate) mod type_alias;
pub(crate) mod variant;
pub(crate) mod union_literal;
pub(crate) mod literal;
pub(crate) mod variant;
use hir::{AsAssocItem, HasAttrs, HirDisplay, ModuleDef, ScopeDef, Type};
use ide_db::{

View file

@ -12,8 +12,8 @@ mod attribute;
mod expression;
mod flyimport;
mod fn_param;
mod item_list;
mod item;
mod item_list;
mod pattern;
mod predicate;
mod proc_macros;

View file

@ -9,6 +9,7 @@ mod apply_change;
pub mod active_parameter;
pub mod assists;
pub mod defs;
pub mod documentation;
pub mod famous_defs;
pub mod helpers;
pub mod items_locator;
@ -22,7 +23,6 @@ pub mod symbol_index;
pub mod traits;
pub mod ty_filter;
pub mod use_trivial_constructor;
pub mod documentation;
pub mod imports {
pub mod import_assets;
@ -35,10 +35,10 @@ pub mod generated {
}
pub mod syntax_helpers {
pub mod node_ext;
pub mod insert_whitespace_into_node;
pub mod format_string;
pub mod format_string_exprs;
pub mod insert_whitespace_into_node;
pub mod node_ext;
pub use parser::LexedStr;
}
@ -414,6 +414,6 @@ impl SnippetCap {
#[cfg(test)]
mod tests {
mod sourcegen_lints;
mod line_index;
mod sourcegen_lints;
}

View file

@ -44,30 +44,30 @@ mod handlers {
pub(crate) mod private_assoc_item;
pub(crate) mod private_field;
pub(crate) mod replace_filter_map_next_with_find_map;
pub(crate) mod trait_impl_orphan;
pub(crate) mod trait_impl_incorrect_safety;
pub(crate) mod trait_impl_missing_assoc_item;
pub(crate) mod trait_impl_orphan;
pub(crate) mod trait_impl_redundant_assoc_item;
pub(crate) mod typed_hole;
pub(crate) mod type_mismatch;
pub(crate) mod typed_hole;
pub(crate) mod undeclared_label;
pub(crate) mod unimplemented_builtin_macro;
pub(crate) mod unreachable_label;
pub(crate) mod unresolved_assoc_item;
pub(crate) mod unresolved_extern_crate;
pub(crate) mod unresolved_field;
pub(crate) mod unresolved_method;
pub(crate) mod unresolved_import;
pub(crate) mod unresolved_macro_call;
pub(crate) mod unresolved_method;
pub(crate) mod unresolved_module;
pub(crate) mod unresolved_proc_macro;
pub(crate) mod undeclared_label;
pub(crate) mod unreachable_label;
pub(crate) mod unused_variables;
// The handlers below are unusual, the implement the diagnostics as well.
pub(crate) mod field_shorthand;
pub(crate) mod useless_braces;
pub(crate) mod unlinked_file;
pub(crate) mod json_is_not_rust;
pub(crate) mod unlinked_file;
pub(crate) mod useless_braces;
}
#[cfg(test)]

View file

@ -69,11 +69,11 @@
// // foo($a, $b) ==>> ($a).foo($b)
// ```
mod fragments;
mod from_comment;
mod matching;
mod nester;
mod parsing;
mod fragments;
mod replacing;
mod resolving;
mod search;

View file

@ -25,13 +25,13 @@ mod bind_pat;
mod binding_mode;
mod chaining;
mod closing_brace;
mod closure_ret;
mod closure_captures;
mod closure_ret;
mod discriminant;
mod fn_lifetime_fn;
mod implicit_drop;
mod implicit_static;
mod param_name;
mod implicit_drop;
mod range_exclusive;
#[derive(Clone, Debug, PartialEq, Eq)]

View file

@ -21,24 +21,25 @@ macro_rules! eprintln {
mod fixture;
mod markup;
mod prime_caches;
mod navigation_target;
mod prime_caches;
mod annotations;
mod call_hierarchy;
mod signature_help;
mod doc_links;
mod highlight_related;
mod expand_macro;
mod extend_selection;
mod fetch_crates;
mod file_structure;
mod folding_ranges;
mod goto_declaration;
mod goto_definition;
mod goto_implementation;
mod goto_type_definition;
mod highlight_related;
mod hover;
mod inlay_hints;
mod interpret_function;
mod join_lines;
mod markdown_remove;
mod matching_brace;
@ -48,6 +49,8 @@ mod parent_module;
mod references;
mod rename;
mod runnables;
mod shuffle_crate_graph;
mod signature_help;
mod ssr;
mod static_index;
mod status;
@ -56,12 +59,9 @@ mod syntax_tree;
mod typing;
mod view_crate_graph;
mod view_hir;
mod view_mir;
mod interpret_function;
mod view_item_tree;
mod shuffle_crate_graph;
mod fetch_crates;
mod view_memory_layout;
mod view_mir;
use std::ffi::OsStr;

View file

@ -3,11 +3,11 @@ pub(crate) mod tags;
mod highlights;
mod injector;
mod highlight;
mod format;
mod macro_;
mod inject;
mod escape;
mod format;
mod highlight;
mod inject;
mod macro_;
mod html;
#[cfg(test)]

View file

@ -8,11 +8,11 @@
#![warn(rust_2018_idioms, unused_lifetimes)]
mod parser;
mod expander;
mod parser;
mod syntax_bridge;
mod tt_iter;
mod to_parser_input;
mod tt_iter;
#[cfg(test)]
mod benchmark;

View file

@ -30,12 +30,12 @@
mod attributes;
mod expressions;
mod generic_args;
mod generic_params;
mod items;
mod params;
mod paths;
mod patterns;
mod generic_args;
mod generic_params;
mod types;
use crate::{

View file

@ -1,5 +1,5 @@
mod consts;
mod adt;
mod consts;
mod traits;
mod use_item;

View file

@ -26,15 +26,15 @@ extern crate ra_ap_rustc_lexer as rustc_lexer;
#[cfg(feature = "in-rust-tree")]
extern crate rustc_lexer;
mod lexed_str;
mod token_set;
mod syntax_kind;
mod event;
mod parser;
mod grammar;
mod input;
mod lexed_str;
mod output;
mod parser;
mod shortcuts;
mod syntax_kind;
mod token_set;
#[cfg(test)]
mod tests;

View file

@ -1,6 +1,6 @@
mod prefix_entries;
mod sourcegen_inline_tests;
mod top_entries;
mod prefix_entries;
use std::{
fmt::Write,

View file

@ -21,8 +21,8 @@ extern crate proc_macro;
extern crate rustc_driver as _;
mod dylib;
mod server;
mod proc_macros;
mod server;
use std::{
collections::{hash_map::Entry, HashMap},

View file

@ -13,9 +13,9 @@ use proc_macro::bridge;
mod token_stream;
pub use token_stream::TokenStream;
pub mod token_id;
pub mod rust_analyzer_span;
mod symbol;
pub mod token_id;
pub use symbol::*;
use tt::Spacing;

View file

@ -2,11 +2,11 @@
#![warn(rust_2018_idioms, unused_lifetimes)]
mod stop_watch;
mod memory_usage;
#[cfg(feature = "cpu_profiler")]
mod google_cpu_profiler;
mod hprof;
mod memory_usage;
mod stop_watch;
mod tree;
use std::cell::RefCell;

View file

@ -17,15 +17,15 @@
#![warn(rust_2018_idioms, unused_lifetimes)]
mod manifest_path;
mod build_scripts;
mod cargo_workspace;
mod cfg_flag;
mod manifest_path;
mod project_json;
mod sysroot;
mod workspace;
mod rustc_cfg;
mod build_scripts;
mod sysroot;
pub mod target_data_layout;
mod workspace;
#[cfg(test)]
mod tests;

View file

@ -1,16 +1,16 @@
//! Various batch processing tasks, intended primarily for debugging.
pub mod flags;
mod parse;
mod symbols;
mod highlight;
mod analysis_stats;
mod diagnostics;
mod ssr;
pub mod flags;
mod highlight;
mod lsif;
mod scip;
mod parse;
mod run_tests;
mod rustc_tests;
mod scip;
mod ssr;
mod symbols;
mod progress_report;

View file

@ -2,11 +2,11 @@
use core::fmt;
pub(crate) mod utils;
pub(crate) mod semantic_tokens;
pub mod ext;
pub(crate) mod from_proto;
pub(crate) mod semantic_tokens;
pub(crate) mod to_proto;
pub(crate) mod utils;
#[derive(Debug)]
pub(crate) struct LspError {

View file

@ -6,13 +6,13 @@ use std::io as sio;
use std::process::Command;
use std::{cmp::Ordering, ops, time::Instant};
pub mod anymap;
mod macros;
pub mod process;
pub mod panic_context;
pub mod non_empty_vec;
pub mod panic_context;
pub mod process;
pub mod rand;
pub mod thread;
pub mod anymap;
pub use always_assert::{always, never};
pub use itertools;

View file

@ -1,15 +1,15 @@
//! Abstract Syntax Tree, layered on top of untyped `SyntaxNode`s
mod generated;
mod traits;
mod token_ext;
mod node_ext;
mod expr_ext;
mod operators;
pub mod edit;
pub mod edit_in_place;
mod expr_ext;
mod generated;
pub mod make;
mod node_ext;
mod operators;
pub mod prec;
mod token_ext;
mod traits;
use std::marker::PhantomData;

View file

@ -32,22 +32,22 @@ macro_rules! eprintln {
($($tt:tt)*) => { stdx::eprintln!($($tt)*) };
}
mod syntax_node;
mod syntax_error;
mod parsing;
mod validation;
mod ptr;
mod token_text;
mod syntax_error;
mod syntax_node;
#[cfg(test)]
mod tests;
mod token_text;
mod validation;
pub mod algo;
pub mod ast;
#[doc(hidden)]
pub mod fuzz;
pub mod utils;
pub mod ted;
pub mod hacks;
pub mod ted;
pub mod utils;
use std::marker::PhantomData;

View file

@ -6,11 +6,11 @@
#![warn(rust_2018_idioms, unused_lifetimes)]
mod msg;
mod stdio;
mod error;
mod socket;
mod msg;
mod req_queue;
mod socket;
mod stdio;
use std::{
io,

View file

@ -12,11 +12,11 @@
mod flags;
mod install;
mod release;
mod dist;
mod publish;
mod install;
mod metrics;
mod publish;
mod release;
use anyhow::bail;
use std::{