Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:
CARGO_NET_RETRY: 10
CI: 1
RUST_BACKTRACE: short
RUSTFLAGS: "-D warnings " # -W unreachable-pub"
RUSTFLAGS: "-D warnings -W unreachable-pub"
RUSTUP_MAX_RETRIES: 10

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTFLAGS: "-D warnings " # -W unreachable-pub"
RUSTFLAGS: "-D warnings -W unreachable-pub"
RUSTUP_MAX_RETRIES: 10

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTFLAGS: "-D warnings " # -W unreachable-pub"
RUSTFLAGS: "-D warnings -W unreachable-pub"
RUSTUP_MAX_RETRIES: 10

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rustdoc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTFLAGS: "-D warnings " # -W unreachable-pub"
RUSTFLAGS: "-D warnings -W unreachable-pub"
RUSTUP_MAX_RETRIES: 10

jobs:
Expand Down
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions crates/assists/src/utils/import_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ pub(crate) enum ImportCandidate {

#[derive(Debug)]
pub(crate) struct TraitImportCandidate {
pub ty: hir::Type,
pub name: ast::NameRef,
pub(crate) ty: hir::Type,
pub(crate) name: ast::NameRef,
}

#[derive(Debug)]
pub(crate) struct PathImportCandidate {
pub name: ast::NameRef,
pub(crate) name: ast::NameRef,
}

#[derive(Debug)]
Expand Down
4 changes: 2 additions & 2 deletions crates/assists/src/utils/insert_use.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ use syntax::{
use test_utils::mark;

#[derive(Debug)]
pub enum ImportScope {
pub(crate) enum ImportScope {
File(ast::SourceFile),
Module(ast::ItemList),
}

impl ImportScope {
pub fn from(syntax: SyntaxNode) -> Option<Self> {
pub(crate) fn from(syntax: SyntaxNode) -> Option<Self> {
if let Some(module) = ast::Module::cast(syntax.clone()) {
module.item_list().map(ImportScope::Module)
} else if let this @ Some(_) = ast::SourceFile::cast(syntax.clone()) {
Expand Down
6 changes: 3 additions & 3 deletions crates/completion/src/completions/postfix/format_like.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ enum State {
}

impl FormatStrParser {
pub fn new(input: String) -> Self {
pub(crate) fn new(input: String) -> Self {
Self {
input: input.into(),
output: String::new(),
Expand All @@ -98,7 +98,7 @@ impl FormatStrParser {
}
}

pub fn parse(&mut self) -> Result<(), ()> {
pub(crate) fn parse(&mut self) -> Result<(), ()> {
let mut current_expr = String::new();

let mut placeholder_id = 1;
Expand Down Expand Up @@ -194,7 +194,7 @@ impl FormatStrParser {
Ok(())
}

pub fn into_suggestion(&self, macro_name: &str) -> String {
pub(crate) fn into_suggestion(&self, macro_name: &str) -> String {
assert!(self.parsed, "Attempt to get a suggestion from not parsed expression");

let expressions_as_string = self.extracted_expressions.join(", ");
Expand Down
14 changes: 5 additions & 9 deletions crates/hir/src/code_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@ use std::{iter, sync::Arc};
use arrayvec::ArrayVec;
use base_db::{CrateDisplayName, CrateId, Edition, FileId};
use either::Either;
use hir_def::find_path::PrefixKind;
use hir_def::{
adt::ReprKind,
adt::StructKind,
adt::VariantData,
builtin_type::BuiltinType,
expr::{BindingAnnotation, Pat, PatId},
import_map,
item_tree::ItemTreeNode,
lang_item::LangItemTarget,
path::ModPath,
per_ns::PerNs,
resolver::{HasResolver, Resolver},
src::HasSource as _,
type_ref::{Mutability, TypeRef},
AdtId, AssocContainerId, AttrDefId, ConstId, DefWithBodyId, EnumId, FunctionId, GenericDefId,
HasModule, ImplId, LocalEnumVariantId, LocalFieldId, LocalModuleId, Lookup, ModuleId, StaticId,
StructId, TraitId, TypeAliasId, TypeParamId, UnionId,
AdtId, AssocContainerId, AssocItemId, AssocItemLoc, AttrDefId, ConstId, DefWithBodyId, EnumId,
FunctionId, GenericDefId, HasModule, ImplId, LocalEnumVariantId, LocalFieldId, LocalModuleId,
Lookup, ModuleId, StaticId, StructId, TraitId, TypeAliasId, TypeParamId, UnionId,
};
use hir_def::{find_path::PrefixKind, item_scope::ItemInNs, visibility::Visibility};
use hir_expand::{
diagnostics::DiagnosticSink,
name::{name, AsName},
Expand Down Expand Up @@ -275,11 +276,6 @@ impl ModuleDef {
}
}

pub use hir_def::{
attr::Attrs, item_scope::ItemInNs, item_tree::ItemTreeNode, visibility::Visibility,
AssocItemId, AssocItemLoc,
};

impl Module {
pub(crate) fn new(krate: Crate, crate_module_id: LocalModuleId) -> Module {
Module { id: ModuleId { krate: krate.id, local_id: crate_module_id } }
Expand Down
8 changes: 4 additions & 4 deletions crates/hir/src/from_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
//! are splitting the hir.

use hir_def::{
expr::PatId, AdtId, AssocItemId, DefWithBodyId, EnumVariantId, FieldId, GenericDefId,
ModuleDefId, VariantId,
expr::PatId, item_scope::ItemInNs, AdtId, AssocItemId, DefWithBodyId, EnumVariantId, FieldId,
GenericDefId, ModuleDefId, VariantId,
};

use crate::{
code_model::ItemInNs, Adt, AssocItem, DefWithBody, EnumVariant, Field, GenericDef, Local,
MacroDef, ModuleDef, VariantDef,
Adt, AssocItem, DefWithBody, EnumVariant, Field, GenericDef, Local, MacroDef, ModuleDef,
VariantDef,
};

macro_rules! from_id {
Expand Down
3 changes: 1 addition & 2 deletions crates/hir/src/has_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ use hir_def::{
src::{HasChildSource, HasSource as _},
Lookup, VariantId,
};
use hir_expand::InFile;
use syntax::ast;

use crate::{
db::HirDatabase, Const, Enum, EnumVariant, Field, FieldSource, Function, ImplDef, MacroDef,
Module, Static, Struct, Trait, TypeAlias, TypeParam, Union,
};

pub use hir_expand::InFile;

pub trait HasSource {
type Ast;
fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast>;
Expand Down
3 changes: 2 additions & 1 deletion crates/hir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub use crate::{
Access, Adt, AsAssocItem, AssocItem, AssocItemContainer, Callable, CallableKind, Const,
Crate, CrateDependency, DefWithBody, Enum, EnumVariant, Field, FieldSource, Function,
GenericDef, HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, ScopeDef, Static,
Struct, Trait, Type, TypeAlias, TypeParam, Union, VariantDef, Visibility,
Struct, Trait, Type, TypeAlias, TypeParam, Union, VariantDef,
},
has_source::HasSource,
semantics::{original_range, PathResolution, Semantics, SemanticsScope},
Expand All @@ -53,6 +53,7 @@ pub use hir_def::{
nameres::ModuleSource,
path::{ModPath, PathKind},
type_ref::{Mutability, TypeRef},
visibility::Visibility,
};
pub use hir_expand::{
name::known, name::AsName, name::Name, HirFileId, InFile, MacroCallId, MacroCallLoc,
Expand Down
4 changes: 2 additions & 2 deletions crates/hir_def/src/body/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use hir_expand::diagnostics::DiagnosticSink;
use crate::diagnostics::InactiveCode;

#[derive(Debug, Eq, PartialEq)]
pub enum BodyDiagnostic {
pub(crate) enum BodyDiagnostic {
InactiveCode(InactiveCode),
}

impl BodyDiagnostic {
pub fn add_to(&self, sink: &mut DiagnosticSink<'_>) {
pub(crate) fn add_to(&self, sink: &mut DiagnosticSink<'_>) {
match self {
BodyDiagnostic::InactiveCode(diag) => {
sink.push(diag.clone());
Expand Down
2 changes: 1 addition & 1 deletion crates/hir_expand/src/test_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use rustc_hash::FxHashSet;
crate::db::AstDatabaseStorage
)]
#[derive(Default)]
pub struct TestDB {
pub(crate) struct TestDB {
storage: salsa::Storage<TestDB>,
events: Mutex<Option<Vec<salsa::Event>>>,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hir_ty/src/infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ enum BindingMode {
}

impl BindingMode {
pub fn convert(annotation: BindingAnnotation) -> BindingMode {
fn convert(annotation: BindingAnnotation) -> BindingMode {
match annotation {
BindingAnnotation::Unannotated | BindingAnnotation::Mutable => BindingMode::Move,
BindingAnnotation::Ref => BindingMode::Ref(Mutability::Shared),
Expand Down
2 changes: 1 addition & 1 deletion crates/hir_ty/src/infer/unify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ where

#[derive(Debug)]
pub(super) struct Canonicalized<T> {
pub value: Canonical<T>,
pub(super) value: Canonical<T>,
free_vars: Vec<InferTy>,
}

Expand Down
2 changes: 1 addition & 1 deletion crates/hir_ty/src/traits/chalk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use mapping::{
TypeAliasAsValue,
};

pub use self::interner::*;
pub(crate) use self::interner::*;

pub(super) mod tls;
mod interner;
Expand Down
30 changes: 15 additions & 15 deletions crates/hir_ty/src/traits/chalk/interner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ use std::{fmt, sync::Arc};
#[derive(Debug, Copy, Clone, Hash, PartialOrd, Ord, PartialEq, Eq)]
pub struct Interner;

pub type AssocTypeId = chalk_ir::AssocTypeId<Interner>;
pub type AssociatedTyDatum = chalk_solve::rust_ir::AssociatedTyDatum<Interner>;
pub type ForeignDefId = chalk_ir::ForeignDefId<Interner>;
pub type TraitId = chalk_ir::TraitId<Interner>;
pub type TraitDatum = chalk_solve::rust_ir::TraitDatum<Interner>;
pub type AdtId = chalk_ir::AdtId<Interner>;
pub type StructDatum = chalk_solve::rust_ir::AdtDatum<Interner>;
pub type ImplId = chalk_ir::ImplId<Interner>;
pub type ImplDatum = chalk_solve::rust_ir::ImplDatum<Interner>;
pub type AssociatedTyValueId = chalk_solve::rust_ir::AssociatedTyValueId<Interner>;
pub type AssociatedTyValue = chalk_solve::rust_ir::AssociatedTyValue<Interner>;
pub type FnDefId = chalk_ir::FnDefId<Interner>;
pub type FnDefDatum = chalk_solve::rust_ir::FnDefDatum<Interner>;
pub type OpaqueTyId = chalk_ir::OpaqueTyId<Interner>;
pub type OpaqueTyDatum = chalk_solve::rust_ir::OpaqueTyDatum<Interner>;
pub(crate) type AssocTypeId = chalk_ir::AssocTypeId<Interner>;
pub(crate) type AssociatedTyDatum = chalk_solve::rust_ir::AssociatedTyDatum<Interner>;
pub(crate) type ForeignDefId = chalk_ir::ForeignDefId<Interner>;
pub(crate) type TraitId = chalk_ir::TraitId<Interner>;
pub(crate) type TraitDatum = chalk_solve::rust_ir::TraitDatum<Interner>;
pub(crate) type AdtId = chalk_ir::AdtId<Interner>;
pub(crate) type StructDatum = chalk_solve::rust_ir::AdtDatum<Interner>;
pub(crate) type ImplId = chalk_ir::ImplId<Interner>;
pub(crate) type ImplDatum = chalk_solve::rust_ir::ImplDatum<Interner>;
pub(crate) type AssociatedTyValueId = chalk_solve::rust_ir::AssociatedTyValueId<Interner>;
pub(crate) type AssociatedTyValue = chalk_solve::rust_ir::AssociatedTyValue<Interner>;
pub(crate) type FnDefId = chalk_ir::FnDefId<Interner>;
pub(crate) type FnDefDatum = chalk_solve::rust_ir::FnDefDatum<Interner>;
pub(crate) type OpaqueTyId = chalk_ir::OpaqueTyId<Interner>;
pub(crate) type OpaqueTyDatum = chalk_solve::rust_ir::OpaqueTyDatum<Interner>;

impl chalk_ir::interner::Interner for Interner {
type InternedType = Arc<chalk_ir::TyData<Self>>;
Expand Down
6 changes: 3 additions & 3 deletions crates/hir_ty/src/traits/chalk/mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ impl ToChalk for CallableDefId {
}
}

pub struct TypeAliasAsAssocType(pub TypeAliasId);
pub(crate) struct TypeAliasAsAssocType(pub(crate) TypeAliasId);

impl ToChalk for TypeAliasAsAssocType {
type Chalk = AssocTypeId;
Expand All @@ -478,7 +478,7 @@ impl ToChalk for TypeAliasAsAssocType {
}
}

pub struct TypeAliasAsForeignType(pub TypeAliasId);
pub(crate) struct TypeAliasAsForeignType(pub(crate) TypeAliasId);

impl ToChalk for TypeAliasAsForeignType {
type Chalk = ForeignDefId;
Expand All @@ -492,7 +492,7 @@ impl ToChalk for TypeAliasAsForeignType {
}
}

pub struct TypeAliasAsValue(pub TypeAliasId);
pub(crate) struct TypeAliasAsValue(pub(crate) TypeAliasId);

impl ToChalk for TypeAliasAsValue {
type Chalk = AssociatedTyValueId;
Expand Down
2 changes: 1 addition & 1 deletion crates/ide/src/diagnostics/fixes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::{diagnostics::Fix, references::rename::rename_with_semantics, FilePos
/// A [Diagnostic] that potentially has a fix available.
///
/// [Diagnostic]: hir::diagnostics::Diagnostic
pub trait DiagnosticWithFix: Diagnostic {
pub(crate) trait DiagnosticWithFix: Diagnostic {
fn fix(&self, sema: &Semantics<RootDatabase>) -> Option<Fix>;
}

Expand Down
9 changes: 4 additions & 5 deletions crates/ide/src/doc_links.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! Resolves and rewrites links in markdown documentation.

use std::convert::TryFrom;
use std::iter::once;
use std::{convert::TryFrom, iter::once};

use itertools::Itertools;
use pulldown_cmark::{BrokenLink, CowStr, Event, InlineStr, LinkType, Options, Parser, Tag};
Expand All @@ -21,10 +20,10 @@ use syntax::{ast, match_ast, AstNode, SyntaxKind::*, SyntaxToken, TokenAtOffset,

use crate::{FilePosition, Semantics};

pub type DocumentationLink = String;
pub(crate) type DocumentationLink = String;

/// Rewrite documentation links in markdown to point to an online host (e.g. docs.rs)
pub fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition) -> String {
pub(crate) fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition) -> String {
let mut cb = |link: BrokenLink| {
Some((
/*url*/ link.reference.to_owned().into(),
Expand Down Expand Up @@ -63,7 +62,7 @@ pub fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition)
}

/// Remove all links in markdown documentation.
pub fn remove_links(markdown: &str) -> String {
pub(crate) fn remove_links(markdown: &str) -> String {
let mut drop_link = false;

let mut opts = Options::empty();
Expand Down
2 changes: 1 addition & 1 deletion crates/ide/src/file_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct StructureNode {
//
// | VS Code | kbd:[Ctrl+Shift+O]
// |===
pub fn file_structure(file: &SourceFile) -> Vec<StructureNode> {
pub(crate) fn file_structure(file: &SourceFile) -> Vec<StructureNode> {
let mut res = Vec::new();
let mut stack = Vec::new();

Expand Down
Loading