Skip to content

Commit ba8d6d1

Browse files
committed
Remove more unreachable pubs
1 parent 731b38f commit ba8d6d1

File tree

39 files changed

+114
-121
lines changed

39 files changed

+114
-121
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212
CARGO_NET_RETRY: 10
1313
CI: 1
1414
RUST_BACKTRACE: short
15-
RUSTFLAGS: "-D warnings " # -W unreachable-pub"
15+
RUSTFLAGS: "-D warnings -W unreachable-pub"
1616
RUSTUP_MAX_RETRIES: 10
1717

1818
jobs:

.github/workflows/metrics.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
env:
88
CARGO_INCREMENTAL: 0
99
CARGO_NET_RETRY: 10
10-
RUSTFLAGS: "-D warnings " # -W unreachable-pub"
10+
RUSTFLAGS: "-D warnings -W unreachable-pub"
1111
RUSTUP_MAX_RETRIES: 10
1212

1313
jobs:

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
env:
1212
CARGO_INCREMENTAL: 0
1313
CARGO_NET_RETRY: 10
14-
RUSTFLAGS: "-D warnings " # -W unreachable-pub"
14+
RUSTFLAGS: "-D warnings -W unreachable-pub"
1515
RUSTUP_MAX_RETRIES: 10
1616

1717
jobs:

.github/workflows/rustdoc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
env:
88
CARGO_INCREMENTAL: 0
99
CARGO_NET_RETRY: 10
10-
RUSTFLAGS: "-D warnings " # -W unreachable-pub"
10+
RUSTFLAGS: "-D warnings -W unreachable-pub"
1111
RUSTUP_MAX_RETRIES: 10
1212

1313
jobs:

crates/assists/src/utils/import_assets.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ pub(crate) enum ImportCandidate {
2626

2727
#[derive(Debug)]
2828
pub(crate) struct TraitImportCandidate {
29-
pub ty: hir::Type,
30-
pub name: ast::NameRef,
29+
pub(crate) ty: hir::Type,
30+
pub(crate) name: ast::NameRef,
3131
}
3232

3333
#[derive(Debug)]
3434
pub(crate) struct PathImportCandidate {
35-
pub name: ast::NameRef,
35+
pub(crate) name: ast::NameRef,
3636
}
3737

3838
#[derive(Debug)]

crates/assists/src/utils/insert_use.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ use syntax::{
1717
use test_utils::mark;
1818

1919
#[derive(Debug)]
20-
pub enum ImportScope {
20+
pub(crate) enum ImportScope {
2121
File(ast::SourceFile),
2222
Module(ast::ItemList),
2323
}
2424

2525
impl ImportScope {
26-
pub fn from(syntax: SyntaxNode) -> Option<Self> {
26+
pub(crate) fn from(syntax: SyntaxNode) -> Option<Self> {
2727
if let Some(module) = ast::Module::cast(syntax.clone()) {
2828
module.item_list().map(ImportScope::Module)
2929
} else if let this @ Some(_) = ast::SourceFile::cast(syntax.clone()) {

crates/completion/src/completions/postfix/format_like.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ enum State {
8888
}
8989

9090
impl FormatStrParser {
91-
pub fn new(input: String) -> Self {
91+
pub(crate) fn new(input: String) -> Self {
9292
Self {
9393
input: input.into(),
9494
output: String::new(),
@@ -98,7 +98,7 @@ impl FormatStrParser {
9898
}
9999
}
100100

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

104104
let mut placeholder_id = 1;
@@ -194,7 +194,7 @@ impl FormatStrParser {
194194
Ok(())
195195
}
196196

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

200200
let expressions_as_string = self.extracted_expressions.join(", ");

crates/hir/src/code_model.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,25 @@ use std::{iter, sync::Arc};
44
use arrayvec::ArrayVec;
55
use base_db::{CrateDisplayName, CrateId, Edition, FileId};
66
use either::Either;
7-
use hir_def::find_path::PrefixKind;
87
use hir_def::{
98
adt::ReprKind,
109
adt::StructKind,
1110
adt::VariantData,
1211
builtin_type::BuiltinType,
1312
expr::{BindingAnnotation, Pat, PatId},
1413
import_map,
14+
item_tree::ItemTreeNode,
1515
lang_item::LangItemTarget,
1616
path::ModPath,
1717
per_ns::PerNs,
1818
resolver::{HasResolver, Resolver},
1919
src::HasSource as _,
2020
type_ref::{Mutability, TypeRef},
21-
AdtId, AssocContainerId, AttrDefId, ConstId, DefWithBodyId, EnumId, FunctionId, GenericDefId,
22-
HasModule, ImplId, LocalEnumVariantId, LocalFieldId, LocalModuleId, Lookup, ModuleId, StaticId,
23-
StructId, TraitId, TypeAliasId, TypeParamId, UnionId,
21+
AdtId, AssocContainerId, AssocItemId, AssocItemLoc, AttrDefId, ConstId, DefWithBodyId, EnumId,
22+
FunctionId, GenericDefId, HasModule, ImplId, LocalEnumVariantId, LocalFieldId, LocalModuleId,
23+
Lookup, ModuleId, StaticId, StructId, TraitId, TypeAliasId, TypeParamId, UnionId,
2424
};
25+
use hir_def::{find_path::PrefixKind, item_scope::ItemInNs, visibility::Visibility};
2526
use hir_expand::{
2627
diagnostics::DiagnosticSink,
2728
name::{name, AsName},
@@ -275,11 +276,6 @@ impl ModuleDef {
275276
}
276277
}
277278

278-
pub use hir_def::{
279-
attr::Attrs, item_scope::ItemInNs, item_tree::ItemTreeNode, visibility::Visibility,
280-
AssocItemId, AssocItemLoc,
281-
};
282-
283279
impl Module {
284280
pub(crate) fn new(krate: Crate, crate_module_id: LocalModuleId) -> Module {
285281
Module { id: ModuleId { krate: krate.id, local_id: crate_module_id } }

crates/hir/src/from_id.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
//! are splitting the hir.
55
66
use hir_def::{
7-
expr::PatId, AdtId, AssocItemId, DefWithBodyId, EnumVariantId, FieldId, GenericDefId,
8-
ModuleDefId, VariantId,
7+
expr::PatId, item_scope::ItemInNs, AdtId, AssocItemId, DefWithBodyId, EnumVariantId, FieldId,
8+
GenericDefId, ModuleDefId, VariantId,
99
};
1010

1111
use crate::{
12-
code_model::ItemInNs, Adt, AssocItem, DefWithBody, EnumVariant, Field, GenericDef, Local,
13-
MacroDef, ModuleDef, VariantDef,
12+
Adt, AssocItem, DefWithBody, EnumVariant, Field, GenericDef, Local, MacroDef, ModuleDef,
13+
VariantDef,
1414
};
1515

1616
macro_rules! from_id {

crates/hir/src/has_source.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@ use hir_def::{
66
src::{HasChildSource, HasSource as _},
77
Lookup, VariantId,
88
};
9+
use hir_expand::InFile;
910
use syntax::ast;
1011

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

16-
pub use hir_expand::InFile;
17-
1817
pub trait HasSource {
1918
type Ast;
2019
fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast>;

0 commit comments

Comments
 (0)