# Change the argument name of From::from

**URL:** <https://internals.rust-lang.org/t/change-the-argument-name-of-from-from/17480>\
**Category:** documentation\
**Created:** [October 3, 2022, 4:24pm UTC](https://internals.rust-lang.org/t/change-the-argument-name-of-from-from/17480 "2022-10-03T16:24:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sky9](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/sky9/32/12959_2.png) [@Sky9](https://internals.rust-lang.org/u/Sky9)\
**Post date:** [October 3, 2022, 4:24pm UTC](https://internals.rust-lang.org/t/change-the-argument-name-of-from-from/17480/1 "2022-10-03T16:24:29Z")

</div>

The `From` trait is currently defined as:

```rust
pub trait From<T>: Sized {
    fn from(_: T) -> Self;
}

```

The name of the argument is `_`. I am proposing to change it to `value`, ie.

```rust
pub trait From<T>: Sized {
    fn from(value: T) -> Self;
}

```

This would be more consistent with the `TryFrom`, which looks like this:

```rust
pub trait TryFrom<T>: Sized {
    type Error;
    fn try_from(value: T) -> Result<Self, Self::Error>;
}

```

The reason for this proposal is twofold:

1. Consistency with the rest of the standard library. The `TryFrom` trait uses `value`, and no `From` implementation uses the default name (as it is quite useless).
2. When generating trait implementations with rust-analyzer/IntelliJ, the parameter name is copied, and it always has to be changed.

Optionally, another name like `x` could be used. I only propose `value` for consistency with `TryFrom`.

Changing parameter names is not a breaking change.

---

<div class="post-metadata">

**Author:** ![RustyYato](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/rustyyato/32/13627_2.png) [@RustyYato](https://internals.rust-lang.org/u/RustyYato)\
**Post date:** [October 3, 2022, 5:34pm UTC](https://internals.rust-lang.org/t/change-the-argument-name-of-from-from/17480/2 "2022-10-03T17:34:24Z")

</div>

I think you can just submit a Pr for this, should be a good first issue!

---

<div class="post-metadata">

**Author:** ![Sky9](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/sky9/32/12959_2.png) [@Sky9](https://internals.rust-lang.org/u/Sky9)\
**Post date:** [October 3, 2022, 5:41pm UTC](https://internals.rust-lang.org/t/change-the-argument-name-of-from-from/17480/3 "2022-10-03T17:41:32Z")

</div>

Ok! I've created [#102628](https://github.com/rust-lang/rust/pull/102628).

---

<div class="post-metadata">

**Author:** ![kaj](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/kaj/32/1387_2.png) [@kaj](https://internals.rust-lang.org/u/kaj)\
**Post date:** [October 6, 2022, 1:14pm UTC](https://internals.rust-lang.org/t/change-the-argument-name-of-from-from/17480/4 "2022-10-06T13:14:05Z")

</div>

Sounds great! No matter which name is choosen, it will increase consistency among implementers of `From`, as many will use the name suggested by rust-analyzer. Beeing constent with `TryFrom` also makes `value` a good name.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [January 4, 2023, 1:14pm UTC](https://internals.rust-lang.org/t/change-the-argument-name-of-from-from/17480/5 "2023-01-04T13:14:32Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
