Skip to content

Commit d5de4c6

Browse files
committed
Revert "Add from docs for tools"
This reverts commit df90691.
1 parent 8de849e commit d5de4c6

File tree

23 files changed

+8
-93
lines changed

23 files changed

+8
-93
lines changed

src/tools/clippy/clippy_lints/src/attrs/mixed_attributes_style.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ enum SimpleAttrKind {
1515
}
1616

1717
impl From<&AttrKind> for SimpleAttrKind {
18-
/// Convert an `AttrKind` to a `SimpleAttrKind`, if it's a `DocComment` then `Doc` is returned with no conversion.
18+
/// Convert an `AttrKind` to a `SimpleAttrKind`,
19+
/// if it's a `DocComment` then `Doc` is returned with no conversion.
1920
///
2021
/// ## Cost
2122
/// If `AttrKind` is `DocComment` it's free, however if it's `Normal` their is heep allocation

src/tools/miri/src/concurrency/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl Idx for ThreadId {
8080
}
8181

8282
impl From<ThreadId> for u64 {
83-
/// Return inner `u32` converted to `u64`
83+
/// Return inner `u32` converted to `u64`.
8484
fn from(t: ThreadId) -> Self {
8585
t.0.into()
8686
}

src/tools/miri/src/concurrency/vector_clock.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl Idx for VectorIdx {
3434
}
3535

3636
impl From<u32> for VectorIdx {
37-
/// Create new `VectorIdx` with `u32` as inner
37+
/// Create new `VectorIdx` with `u32` as inner.
3838
#[inline]
3939
fn from(id: u32) -> Self {
4040
Self(id)

src/tools/miri/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ extern crate rustc_middle;
7474
extern crate rustc_session;
7575
extern crate rustc_span;
7676
extern crate rustc_target;
77-
// Linking `rustc_driver` pulls in the required object code as the rest of the rustc crates are
77+
// Linking `rustc_driver` pulls in the required object code as the rest of the rustc crates are
7878
// shipped only as rmeta files.
7979
#[allow(unused_extern_crates)]
8080
extern crate rustc_driver;

src/tools/miri/src/shims/io_error.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ pub enum IoError {
1414
pub use self::IoError::*;
1515

1616
impl From<io::Error> for IoError {
17-
/// Wrap `io::Error` in `HostError`
17+
/// Wrap `io::Error` in `HostError`.
1818
fn from(value: io::Error) -> Self {
1919
IoError::HostError(value)
2020
}
2121
}
2222

2323
impl From<io::ErrorKind> for IoError {
24-
/// Convert a `io::ErrorKind` to a `io::Error` then wrap in `HostError`
24+
/// Convert a `io::ErrorKind` to a `io::Error` then wrap in `HostError`.
2525
fn from(value: io::ErrorKind) -> Self {
2626
IoError::HostError(value.into())
2727
}
2828
}
2929

3030
impl From<Scalar> for IoError {
31-
/// Wrap `Scalar` in `Raw`
31+
/// Wrap `Scalar` in `Raw`.
3232
fn from(value: Scalar) -> Self {
3333
IoError::Raw(value)
3434
}

src/tools/rust-analyzer/crates/base-db/src/input.rs

-10
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,6 @@ pub enum LangCrateOrigin {
173173
}
174174

175175
impl From<&str> for LangCrateOrigin {
176-
/// Match a string slice for "alloc", "core", "proc-macro", "proc_macro", "std", "test",
177-
/// mapping them to variants of the same name; if none match then it's `Other`
178176
fn from(s: &str) -> Self {
179177
match s {
180178
"alloc" => LangCrateOrigin::Alloc,
@@ -219,10 +217,6 @@ impl CrateDisplayName {
219217
}
220218

221219
impl From<CrateName> for CrateDisplayName {
222-
/// Creates a `CrateDisplayName` from `crate_name` and `crate_name.0`(inner)
223-
///
224-
/// ## Cost
225-
/// This clones `CrateName`
226220
fn from(crate_name: CrateName) -> CrateDisplayName {
227221
let canonical_name = crate_name.0.clone();
228222
CrateDisplayName { crate_name, canonical_name }
@@ -640,10 +634,6 @@ impl Env {
640634
}
641635

642636
impl From<Env> for Vec<(String, String)> {
643-
/// Iterates the hash map entries collects them in to a `Vec` then sorts it.
644-
///
645-
/// ## Cost
646-
/// This is expensive as it `collect`s and `sort`s env
647637
fn from(env: Env) -> Vec<(String, String)> {
648638
let mut entries: Vec<_> = env.entries.into_iter().collect();
649639
entries.sort();

src/tools/rust-analyzer/crates/cfg/src/cfg_expr.rs

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ pub enum CfgExpr {
3838
}
3939

4040
impl From<CfgAtom> for CfgExpr {
41-
/// Wrap `CfgAtom` in `CfgExpr::Atom`
4241
fn from(atom: CfgAtom) -> Self {
4342
CfgExpr::Atom(atom)
4443
}

src/tools/rust-analyzer/crates/hir-def/src/attr.rs

-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ pub enum DocExpr {
245245
}
246246

247247
impl From<DocAtom> for DocExpr {
248-
/// Creates `Atom` with `DocAtom`
249248
fn from(atom: DocAtom) -> Self {
250249
DocExpr::Atom(atom)
251250
}

src/tools/rust-analyzer/crates/hir-def/src/hir.rs

-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ impl Literal {
146146
}
147147

148148
impl From<ast::LiteralKind> for Literal {
149-
/// Create a `Literal` by matching `LiteralKind`
150149
fn from(ast_lit_kind: ast::LiteralKind) -> Self {
151150
use ast::LiteralKind;
152151
match ast_lit_kind {

src/tools/rust-analyzer/crates/hir-def/src/hir/type_ref.rs

-2
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,6 @@ impl LiteralConstRef {
637637
}
638638

639639
impl From<Literal> for LiteralConstRef {
640-
/// Make a `LiteralConstRef` from `Literal`
641-
/// - Note: `Char`, `Bool`, `Int`, `Uint` match, other types are not const and return a `Unknown`
642640
fn from(literal: Literal) -> Self {
643641
match literal {
644642
Literal::Char(c) => Self::Char(c),

src/tools/rust-analyzer/crates/hir-def/src/item_scope.rs

-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ pub enum ImportOrExternCrate {
3737
}
3838

3939
impl From<ImportOrGlob> for ImportOrExternCrate {
40-
/// Matches a `ImportOrGlob` to it's corresponding `ImportOrExternCrate` variant, of the same name
4140
fn from(value: ImportOrGlob) -> Self {
4241
match value {
4342
ImportOrGlob::Glob(it) => ImportOrExternCrate::Glob(it),
@@ -102,7 +101,6 @@ pub enum ImportOrDef {
102101
}
103102

104103
impl From<ImportOrExternCrate> for ImportOrDef {
105-
/// Matches a `ImportOrExternCrate` to it's corresponding `ImportOrDef` variant, of the same name
106104
fn from(value: ImportOrExternCrate) -> Self {
107105
match value {
108106
ImportOrExternCrate::Import(it) => ImportOrDef::Import(it),
@@ -113,7 +111,6 @@ impl From<ImportOrExternCrate> for ImportOrDef {
113111
}
114112

115113
impl From<ImportOrGlob> for ImportOrDef {
116-
/// Matches a `ImportOrGlob` to it's corresponding `ImportOrDef` variant, of the same name
117114
fn from(value: ImportOrGlob) -> Self {
118115
match value {
119116
ImportOrGlob::Import(it) => ImportOrDef::Import(it),

src/tools/rust-analyzer/crates/hir-def/src/item_tree.rs

-23
Original file line numberDiff line numberDiff line change
@@ -516,11 +516,6 @@ macro_rules! from_attrs {
516516
( $( $var:ident($t:ty) ),+ $(,)? ) => {
517517
$(
518518
impl From<$t> for AttrOwner {
519-
#[doc = concat!(
520-
"Create a `", stringify!($var), "` from a `", stringify!($t), "`",
521-
"\n\n## Cost",
522-
"This is free as it puts `", stringify!($t), "` into `", stringify!($var), "`"
523-
)]
524519
fn from(t: $t) -> AttrOwner {
525520
AttrOwner::$var(t)
526521
}
@@ -727,10 +722,6 @@ macro_rules! mod_items {
727722
}
728723

729724
impl From<GenericModItem> for ModItem {
730-
/// Create a `ModItem` from a `GenericModItem` variant of the same name
731-
///
732-
/// ## Cost
733-
/// Just a `match`
734725
fn from(id: GenericModItem) -> ModItem {
735726
match id {
736727
$(
@@ -744,26 +735,20 @@ macro_rules! mod_items {
744735
}
745736

746737
impl From<GenericModItem> for AttrOwner {
747-
/// Create a `AttrOwner::ModItem` with `GenericModItem` as inner
748-
///
749-
/// ## Cost
750-
/// The cost is that of the `t.into()` call
751738
fn from(t: GenericModItem) -> AttrOwner {
752739
AttrOwner::ModItem(t.into())
753740
}
754741
}
755742

756743
$(
757744
impl From<FileItemTreeId<$typ>> for ModItem {
758-
#[doc = concat!("Create a `ModItem<", stringify!($typ), ">` from a `FileItemTreeId<", stringify!($typ), ">` variant of the same name")]
759745
fn from(id: FileItemTreeId<$typ>) -> ModItem {
760746
ModItem::$typ(id)
761747
}
762748
}
763749
$(
764750
#[cfg_attr(ignore_fragment, $generic_params)]
765751
impl From<FileItemTreeId<$typ>> for GenericModItem {
766-
#[doc = concat!("Create a `GenericModItem` from a `FileItemTreeId<", stringify!($typ), ">` variant of the same name")]
767752
fn from(id: FileItemTreeId<$typ>) -> GenericModItem {
768753
GenericModItem::$typ(id)
769754
}
@@ -1263,10 +1248,6 @@ macro_rules! impl_froms {
12631248
($e:ident { $($v:ident ($t:ty)),* $(,)? }) => {
12641249
$(
12651250
impl From<$t> for $e {
1266-
#[doc = concat!(
1267-
"Create a `", stringify!($e), "` with `", stringify!($t), "` as the inner",
1268-
"\n\n## Cost\n", stringify!($t), " gets move into ", stringify!($v)
1269-
)]
12701251
fn from(it: $t) -> $e {
12711252
$e::$v(it)
12721253
}
@@ -1315,10 +1296,6 @@ impl_froms!(AssocItem {
13151296
});
13161297

13171298
impl From<AssocItem> for ModItem {
1318-
/// Convert the `AssocItem`s inner to a `ModItem`
1319-
///
1320-
/// ## Cost
1321-
/// The cost is that of the inner items `into` call
13221299
fn from(item: AssocItem) -> Self {
13231300
match item {
13241301
AssocItem::Function(it) => it.into(),

src/tools/rust-analyzer/crates/hir-def/src/lib.rs

-17
Original file line numberDiff line numberDiff line change
@@ -410,21 +410,18 @@ impl PartialEq<CrateRootModuleId> for ModuleId {
410410
}
411411

412412
impl From<CrateRootModuleId> for ModuleId {
413-
/// Make a `ModuleId` with a krate, no block, and local_id of `ROOT`
414413
fn from(CrateRootModuleId { krate }: CrateRootModuleId) -> Self {
415414
ModuleId { krate, block: None, local_id: DefMap::ROOT }
416415
}
417416
}
418417

419418
impl From<CrateRootModuleId> for ModuleDefId {
420-
/// Make a `ModuleId` with `CrateRootModuleId` as inner
421419
fn from(value: CrateRootModuleId) -> Self {
422420
ModuleDefId::ModuleId(value.into())
423421
}
424422
}
425423

426424
impl From<CrateId> for CrateRootModuleId {
427-
/// Create a `CrateRootModuleId` with `CrateId` as inner
428425
fn from(krate: CrateId) -> Self {
429426
CrateRootModuleId { krate }
430427
}
@@ -567,7 +564,6 @@ impl TypeParamId {
567564
}
568565

569566
impl From<TypeParamId> for TypeOrConstParamId {
570-
/// Get the inner `TypeOrConstParamId` of `TypeParamId`
571567
fn from(it: TypeParamId) -> Self {
572568
it.0
573569
}
@@ -594,7 +590,6 @@ impl ConstParamId {
594590
}
595591

596592
impl From<ConstParamId> for TypeOrConstParamId {
597-
/// Get the inner `TypeOrConstParamId` of `ConstParamId`
598593
fn from(it: ConstParamId) -> Self {
599594
it.0
600595
}
@@ -734,7 +729,6 @@ impl_from!(
734729

735730
// Every `DefWithBodyId` is a type owner, since bodies can contain type (e.g. `{ let it: Type = _; }`)
736731
impl From<DefWithBodyId> for TypeOwnerId {
737-
/// Convert `DefWithBodyId` inner into `TypeOwnerId`
738732
fn from(value: DefWithBodyId) -> Self {
739733
match value {
740734
DefWithBodyId::FunctionId(it) => it.into(),
@@ -747,7 +741,6 @@ impl From<DefWithBodyId> for TypeOwnerId {
747741
}
748742

749743
impl From<GenericDefId> for TypeOwnerId {
750-
/// Convert `GenericDefId` inner into `TypeOwnerId`
751744
fn from(value: GenericDefId) -> Self {
752745
match value {
753746
GenericDefId::FunctionId(it) => it.into(),
@@ -903,7 +896,6 @@ pub enum DefWithBodyId {
903896
impl_from!(FunctionId, ConstId, StaticId, InTypeConstId for DefWithBodyId);
904897

905898
impl From<EnumVariantId> for DefWithBodyId {
906-
/// Make a `VariantId` with `EnumVariantId`, as inner
907899
fn from(id: EnumVariantId) -> Self {
908900
DefWithBodyId::VariantId(id)
909901
}
@@ -1016,7 +1008,6 @@ impl GenericDefId {
10161008
}
10171009

10181010
impl From<AssocItemId> for GenericDefId {
1019-
/// Convert `AssocItemId` inner to `GenericDefId`
10201011
fn from(item: AssocItemId) -> Self {
10211012
match item {
10221013
AssocItemId::FunctionId(f) => f.into(),
@@ -1037,7 +1028,6 @@ impl InternValueTrivial for CallableDefId {}
10371028

10381029
impl_from!(FunctionId, StructId, EnumVariantId for CallableDefId);
10391030
impl From<CallableDefId> for ModuleDefId {
1040-
/// Match `CallableDefId` to `ModuleDefId`
10411031
fn from(def: CallableDefId) -> ModuleDefId {
10421032
match def {
10431033
CallableDefId::FunctionId(f) => ModuleDefId::FunctionId(f),
@@ -1099,10 +1089,6 @@ impl_from!(
10991089
impl TryFrom<ModuleDefId> for AttrDefId {
11001090
type Error = ();
11011091

1102-
/// Convert the inner of `ModuleDefId` into `Ok(AttrDefId)`
1103-
///
1104-
/// # Errors
1105-
/// `BuiltinType` results in `Err`
11061092
fn try_from(value: ModuleDefId) -> Result<Self, Self::Error> {
11071093
match value {
11081094
ModuleDefId::ModuleId(it) => Ok(it.into()),
@@ -1121,7 +1107,6 @@ impl TryFrom<ModuleDefId> for AttrDefId {
11211107
}
11221108

11231109
impl From<ItemContainerId> for AttrDefId {
1124-
/// Match `ItemContainerId` to the `AttrDefId` variant of the same name
11251110
fn from(acid: ItemContainerId) -> Self {
11261111
match acid {
11271112
ItemContainerId::ModuleId(mid) => AttrDefId::ModuleId(mid),
@@ -1132,7 +1117,6 @@ impl From<ItemContainerId> for AttrDefId {
11321117
}
11331118
}
11341119
impl From<AssocItemId> for AttrDefId {
1135-
/// Match `AssocItemId` to the `AttrDefId` variant of the same name
11361120
fn from(assoc: AssocItemId) -> Self {
11371121
match assoc {
11381122
AssocItemId::FunctionId(it) => AttrDefId::FunctionId(it),
@@ -1142,7 +1126,6 @@ impl From<AssocItemId> for AttrDefId {
11421126
}
11431127
}
11441128
impl From<VariantId> for AttrDefId {
1145-
/// Convert the inner of `VariantId` into `AttrDefId`
11461129
fn from(vid: VariantId) -> Self {
11471130
match vid {
11481131
VariantId::EnumVariantId(id) => id.into(),

src/tools/rust-analyzer/crates/hir-def/src/path.rs

-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ impl GenericArgs {
328328
}
329329

330330
impl From<Name> for Path {
331-
/// Make a `BarePath` with a new `Interned` containing a `ModPath` using the `Name`
332331
fn from(name: Name) -> Path {
333332
Path::BarePath(Interned::new(ModPath::from_segments(PathKind::Plain, iter::once(name))))
334333
}

src/tools/rust-analyzer/crates/hir-ty/src/consteval.rs

-9
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ impl ConstEvalError {
7272
}
7373

7474
impl From<MirLowerError> for ConstEvalError {
75-
/// Convert `MirLowerError` to `ConstEvalError` by getting inner of `MirLowerError::ConstEvalError`
76-
/// or wrapping it in the `MirLowerError` variant
77-
///
78-
/// ## Cost
79-
/// Just a `match`
8075
fn from(value: MirLowerError) -> Self {
8176
match value {
8277
MirLowerError::ConstEvalError(_, e) => *e,
@@ -86,10 +81,6 @@ impl From<MirLowerError> for ConstEvalError {
8681
}
8782

8883
impl From<MirEvalError> for ConstEvalError {
89-
/// Convert a `MirEvalError` by wrapping it in the `ConstEvalError::MirEvalError` variant
90-
///
91-
/// ## Cost
92-
/// Free
9384
fn from(value: MirEvalError) -> Self {
9485
ConstEvalError::MirEvalError(value)
9586
}

src/tools/rust-analyzer/crates/hir-ty/src/display.rs

-1
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,6 @@ pub enum HirDisplayError {
438438
FmtError,
439439
}
440440
impl From<fmt::Error> for HirDisplayError {
441-
/// Ignore the `fmt::Error` and return `Self::FmtError`
442441
fn from(_: fmt::Error) -> Self {
443442
Self::FmtError
444443
}

src/tools/rust-analyzer/crates/hir-ty/src/layout.rs

-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ impl fmt::Display for LayoutError {
110110
}
111111

112112
impl<F> From<LayoutCalculatorError<F>> for LayoutError {
113-
/// Make a `BadCalc` error from a `LayoutCalculatorError` without payload
114113
fn from(err: LayoutCalculatorError<F>) -> Self {
115114
LayoutError::BadCalc(err.without_payload())
116115
}

0 commit comments

Comments
 (0)