Skip to content

Commit 3a1054f

Browse files
committed
Replace x with it
1 parent 4125fea commit 3a1054f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+590
-582
lines changed

crates/base-db/src/fixture.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ impl ChangeFixture {
224224
false,
225225
CrateOrigin::Local { repo: None, name: None },
226226
default_target_data_layout
227-
.map(|x| x.into())
227+
.map(|it| it.into())
228228
.ok_or_else(|| "target_data_layout unset".into()),
229229
Some(toolchain),
230230
);

crates/cfg/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl CfgOptions {
6969
}
7070

7171
pub fn get_cfg_keys(&self) -> impl Iterator<Item = &SmolStr> {
72-
self.enabled.iter().map(|x| match x {
72+
self.enabled.iter().map(|it| match it {
7373
CfgAtom::Flag(key) => key,
7474
CfgAtom::KeyValue { key, .. } => key,
7575
})
@@ -79,7 +79,7 @@ impl CfgOptions {
7979
&'a self,
8080
cfg_key: &'a str,
8181
) -> impl Iterator<Item = &'a SmolStr> + 'a {
82-
self.enabled.iter().filter_map(move |x| match x {
82+
self.enabled.iter().filter_map(move |it| match it {
8383
CfgAtom::KeyValue { key, value } if cfg_key == key => Some(value),
8484
_ => None,
8585
})

crates/hir-def/src/attr.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,13 @@ impl Attrs {
276276
}
277277

278278
pub fn is_test(&self) -> bool {
279-
self.iter().any(|x| {
280-
x.path()
279+
self.iter().any(|it| {
280+
it.path()
281281
.segments()
282282
.iter()
283283
.rev()
284284
.zip(["core", "prelude", "v1", "test"].iter().rev())
285-
.all(|x| x.0.as_str() == Some(x.1))
285+
.all(|it| it.0.as_str() == Some(it.1))
286286
})
287287
}
288288

@@ -304,7 +304,7 @@ use std::slice::Iter as SliceIter;
304304
pub enum DocAtom {
305305
/// eg. `#[doc(hidden)]`
306306
Flag(SmolStr),
307-
/// eg. `#[doc(alias = "x")]`
307+
/// eg. `#[doc(alias = "it")]`
308308
///
309309
/// Note that a key can have multiple values that are all considered "active" at the same time.
310310
/// For example, `#[doc(alias = "x")]` and `#[doc(alias = "y")]`.

crates/hir-def/src/body.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,10 @@ impl Body {
273273

274274
pub fn is_binding_upvar(&self, binding: BindingId, relative_to: ExprId) -> bool {
275275
match self.binding_owners.get(&binding) {
276-
Some(x) => {
276+
Some(it) => {
277277
// We assign expression ids in a way that outer closures will receive
278278
// a lower id
279-
x.into_raw() < relative_to.into_raw()
279+
it.into_raw() < relative_to.into_raw()
280280
}
281281
None => true,
282282
}

crates/hir-def/src/body/lower.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,11 @@ impl ExprCollector<'_> {
297297
let (result_expr_id, prev_binding_owner) =
298298
this.initialize_binding_owner(syntax_ptr);
299299
let inner_expr = this.collect_block(e);
300-
let x = this.db.intern_anonymous_const(ConstBlockLoc {
300+
let it = this.db.intern_anonymous_const(ConstBlockLoc {
301301
parent: this.owner,
302302
root: inner_expr,
303303
});
304-
this.body.exprs[result_expr_id] = Expr::Const(x);
304+
this.body.exprs[result_expr_id] = Expr::Const(it);
305305
this.current_binding_owner = prev_binding_owner;
306306
result_expr_id
307307
})
@@ -324,10 +324,10 @@ impl ExprCollector<'_> {
324324
ast::Expr::CallExpr(e) => {
325325
let is_rustc_box = {
326326
let attrs = e.attrs();
327-
attrs.filter_map(|x| x.as_simple_atom()).any(|x| x == "rustc_box")
327+
attrs.filter_map(|it| it.as_simple_atom()).any(|it| it == "rustc_box")
328328
};
329329
if is_rustc_box {
330-
let expr = self.collect_expr_opt(e.arg_list().and_then(|x| x.args().next()));
330+
let expr = self.collect_expr_opt(e.arg_list().and_then(|it| it.args().next()));
331331
self.alloc_expr(Expr::Box { expr }, syntax_ptr)
332332
} else {
333333
let callee = self.collect_expr_opt(e.expr());
@@ -781,7 +781,7 @@ impl ExprCollector<'_> {
781781
pat: self.alloc_pat_desugared(some_pat),
782782
guard: None,
783783
expr: self.with_opt_labeled_rib(label, |this| {
784-
this.collect_expr_opt(e.loop_body().map(|x| x.into()))
784+
this.collect_expr_opt(e.loop_body().map(|it| it.into()))
785785
}),
786786
};
787787
let iter_name = Name::generate_new_name();
@@ -874,10 +874,10 @@ impl ExprCollector<'_> {
874874
}),
875875
guard: None,
876876
expr: {
877-
let x = self.alloc_expr(Expr::Path(Path::from(break_name)), syntax_ptr.clone());
877+
let it = self.alloc_expr(Expr::Path(Path::from(break_name)), syntax_ptr.clone());
878878
let callee = self.alloc_expr(Expr::Path(try_from_residual), syntax_ptr.clone());
879879
let result = self.alloc_expr(
880-
Expr::Call { callee, args: Box::new([x]), is_assignee_expr: false },
880+
Expr::Call { callee, args: Box::new([it]), is_assignee_expr: false },
881881
syntax_ptr.clone(),
882882
);
883883
self.alloc_expr(
@@ -1240,12 +1240,12 @@ impl ExprCollector<'_> {
12401240
pats.push(self.collect_pat(first, binding_list));
12411241
binding_list.reject_new = true;
12421242
for rest in it {
1243-
for (_, x) in binding_list.is_used.iter_mut() {
1244-
*x = false;
1243+
for (_, it) in binding_list.is_used.iter_mut() {
1244+
*it = false;
12451245
}
12461246
pats.push(self.collect_pat(rest, binding_list));
1247-
for (&id, &x) in binding_list.is_used.iter() {
1248-
if !x {
1247+
for (&id, &is_used) in binding_list.is_used.iter() {
1248+
if !is_used {
12491249
self.body.bindings[id].problems =
12501250
Some(BindingProblems::NotBoundAcrossAll);
12511251
}
@@ -1352,9 +1352,9 @@ impl ExprCollector<'_> {
13521352
// FIXME: implement in a way that also builds source map and calculates assoc resolutions in type inference.
13531353
ast::Pat::RangePat(p) => {
13541354
let mut range_part_lower = |p: Option<ast::Pat>| {
1355-
p.and_then(|x| match &x {
1356-
ast::Pat::LiteralPat(x) => {
1357-
Some(Box::new(LiteralOrConst::Literal(pat_literal_to_hir(x)?.0)))
1355+
p.and_then(|it| match &it {
1356+
ast::Pat::LiteralPat(it) => {
1357+
Some(Box::new(LiteralOrConst::Literal(pat_literal_to_hir(it)?.0)))
13581358
}
13591359
ast::Pat::IdentPat(p) => {
13601360
let name =

crates/hir-def/src/generics.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -67,36 +67,36 @@ pub enum TypeOrConstParamData {
6767
impl TypeOrConstParamData {
6868
pub fn name(&self) -> Option<&Name> {
6969
match self {
70-
TypeOrConstParamData::TypeParamData(x) => x.name.as_ref(),
71-
TypeOrConstParamData::ConstParamData(x) => Some(&x.name),
70+
TypeOrConstParamData::TypeParamData(it) => it.name.as_ref(),
71+
TypeOrConstParamData::ConstParamData(it) => Some(&it.name),
7272
}
7373
}
7474

7575
pub fn has_default(&self) -> bool {
7676
match self {
77-
TypeOrConstParamData::TypeParamData(x) => x.default.is_some(),
78-
TypeOrConstParamData::ConstParamData(x) => x.has_default,
77+
TypeOrConstParamData::TypeParamData(it) => it.default.is_some(),
78+
TypeOrConstParamData::ConstParamData(it) => it.has_default,
7979
}
8080
}
8181

8282
pub fn type_param(&self) -> Option<&TypeParamData> {
8383
match self {
84-
TypeOrConstParamData::TypeParamData(x) => Some(x),
84+
TypeOrConstParamData::TypeParamData(it) => Some(it),
8585
TypeOrConstParamData::ConstParamData(_) => None,
8686
}
8787
}
8888

8989
pub fn const_param(&self) -> Option<&ConstParamData> {
9090
match self {
9191
TypeOrConstParamData::TypeParamData(_) => None,
92-
TypeOrConstParamData::ConstParamData(x) => Some(x),
92+
TypeOrConstParamData::ConstParamData(it) => Some(it),
9393
}
9494
}
9595

9696
pub fn is_trait_self(&self) -> bool {
9797
match self {
98-
TypeOrConstParamData::TypeParamData(x) => {
99-
x.provenance == TypeParamProvenance::TraitSelf
98+
TypeOrConstParamData::TypeParamData(it) => {
99+
it.provenance == TypeParamProvenance::TraitSelf
100100
}
101101
TypeOrConstParamData::ConstParamData(_) => false,
102102
}

crates/hir-def/src/hir/type_ref.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,8 @@ impl ConstRef {
425425
}
426426
match expr {
427427
ast::Expr::PathExpr(p) if is_path_ident(&p) => {
428-
match p.path().and_then(|x| x.segment()).and_then(|x| x.name_ref()) {
429-
Some(x) => Self::Path(x.as_name()),
428+
match p.path().and_then(|it| it.segment()).and_then(|it| it.name_ref()) {
429+
Some(it) => Self::Path(it.as_name()),
430430
None => Self::Scalar(LiteralConstRef::Unknown),
431431
}
432432
}

crates/hir-def/src/lib.rs

+42-42
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,14 @@ impl TypeParamId {
406406

407407
impl TypeParamId {
408408
/// Caller should check if this toc id really belongs to a type
409-
pub fn from_unchecked(x: TypeOrConstParamId) -> Self {
410-
Self(x)
409+
pub fn from_unchecked(it: TypeOrConstParamId) -> Self {
410+
Self(it)
411411
}
412412
}
413413

414414
impl From<TypeParamId> for TypeOrConstParamId {
415-
fn from(x: TypeParamId) -> Self {
416-
x.0
415+
fn from(it: TypeParamId) -> Self {
416+
it.0
417417
}
418418
}
419419

@@ -432,14 +432,14 @@ impl ConstParamId {
432432

433433
impl ConstParamId {
434434
/// Caller should check if this toc id really belongs to a const
435-
pub fn from_unchecked(x: TypeOrConstParamId) -> Self {
436-
Self(x)
435+
pub fn from_unchecked(it: TypeOrConstParamId) -> Self {
436+
Self(it)
437437
}
438438
}
439439

440440
impl From<ConstParamId> for TypeOrConstParamId {
441-
fn from(x: ConstParamId) -> Self {
442-
x.0
441+
fn from(it: ConstParamId) -> Self {
442+
it.0
443443
}
444444
}
445445

@@ -562,14 +562,14 @@ pub enum TypeOwnerId {
562562
impl TypeOwnerId {
563563
fn as_generic_def_id(self) -> Option<GenericDefId> {
564564
Some(match self {
565-
TypeOwnerId::FunctionId(x) => GenericDefId::FunctionId(x),
566-
TypeOwnerId::ConstId(x) => GenericDefId::ConstId(x),
567-
TypeOwnerId::AdtId(x) => GenericDefId::AdtId(x),
568-
TypeOwnerId::TraitId(x) => GenericDefId::TraitId(x),
569-
TypeOwnerId::TraitAliasId(x) => GenericDefId::TraitAliasId(x),
570-
TypeOwnerId::TypeAliasId(x) => GenericDefId::TypeAliasId(x),
571-
TypeOwnerId::ImplId(x) => GenericDefId::ImplId(x),
572-
TypeOwnerId::EnumVariantId(x) => GenericDefId::EnumVariantId(x),
565+
TypeOwnerId::FunctionId(it) => GenericDefId::FunctionId(it),
566+
TypeOwnerId::ConstId(it) => GenericDefId::ConstId(it),
567+
TypeOwnerId::AdtId(it) => GenericDefId::AdtId(it),
568+
TypeOwnerId::TraitId(it) => GenericDefId::TraitId(it),
569+
TypeOwnerId::TraitAliasId(it) => GenericDefId::TraitAliasId(it),
570+
TypeOwnerId::TypeAliasId(it) => GenericDefId::TypeAliasId(it),
571+
TypeOwnerId::ImplId(it) => GenericDefId::ImplId(it),
572+
TypeOwnerId::EnumVariantId(it) => GenericDefId::EnumVariantId(it),
573573
TypeOwnerId::InTypeConstId(_) | TypeOwnerId::ModuleId(_) | TypeOwnerId::StaticId(_) => {
574574
return None
575575
}
@@ -592,30 +592,30 @@ impl_from!(
592592
for TypeOwnerId
593593
);
594594

595-
// Every `DefWithBodyId` is a type owner, since bodies can contain type (e.g. `{ let x: Type = _; }`)
595+
// Every `DefWithBodyId` is a type owner, since bodies can contain type (e.g. `{ let it: Type = _; }`)
596596
impl From<DefWithBodyId> for TypeOwnerId {
597597
fn from(value: DefWithBodyId) -> Self {
598598
match value {
599-
DefWithBodyId::FunctionId(x) => x.into(),
600-
DefWithBodyId::StaticId(x) => x.into(),
601-
DefWithBodyId::ConstId(x) => x.into(),
602-
DefWithBodyId::InTypeConstId(x) => x.into(),
603-
DefWithBodyId::VariantId(x) => x.into(),
599+
DefWithBodyId::FunctionId(it) => it.into(),
600+
DefWithBodyId::StaticId(it) => it.into(),
601+
DefWithBodyId::ConstId(it) => it.into(),
602+
DefWithBodyId::InTypeConstId(it) => it.into(),
603+
DefWithBodyId::VariantId(it) => it.into(),
604604
}
605605
}
606606
}
607607

608608
impl From<GenericDefId> for TypeOwnerId {
609609
fn from(value: GenericDefId) -> Self {
610610
match value {
611-
GenericDefId::FunctionId(x) => x.into(),
612-
GenericDefId::AdtId(x) => x.into(),
613-
GenericDefId::TraitId(x) => x.into(),
614-
GenericDefId::TraitAliasId(x) => x.into(),
615-
GenericDefId::TypeAliasId(x) => x.into(),
616-
GenericDefId::ImplId(x) => x.into(),
617-
GenericDefId::EnumVariantId(x) => x.into(),
618-
GenericDefId::ConstId(x) => x.into(),
611+
GenericDefId::FunctionId(it) => it.into(),
612+
GenericDefId::AdtId(it) => it.into(),
613+
GenericDefId::TraitId(it) => it.into(),
614+
GenericDefId::TraitAliasId(it) => it.into(),
615+
GenericDefId::TypeAliasId(it) => it.into(),
616+
GenericDefId::ImplId(it) => it.into(),
617+
GenericDefId::EnumVariantId(it) => it.into(),
618+
GenericDefId::ConstId(it) => it.into(),
619619
}
620620
}
621621
}
@@ -730,7 +730,7 @@ impl GeneralConstId {
730730
.const_data(const_id)
731731
.name
732732
.as_ref()
733-
.and_then(|x| x.as_str())
733+
.and_then(|it| it.as_str())
734734
.unwrap_or("_")
735735
.to_owned(),
736736
GeneralConstId::ConstBlockId(id) => format!("{{anonymous const {id:?}}}"),
@@ -972,17 +972,17 @@ impl HasModule for MacroId {
972972
impl HasModule for TypeOwnerId {
973973
fn module(&self, db: &dyn db::DefDatabase) -> ModuleId {
974974
match self {
975-
TypeOwnerId::FunctionId(x) => x.lookup(db).module(db),
976-
TypeOwnerId::StaticId(x) => x.lookup(db).module(db),
977-
TypeOwnerId::ConstId(x) => x.lookup(db).module(db),
978-
TypeOwnerId::InTypeConstId(x) => x.lookup(db).owner.module(db),
979-
TypeOwnerId::AdtId(x) => x.module(db),
980-
TypeOwnerId::TraitId(x) => x.lookup(db).container,
981-
TypeOwnerId::TraitAliasId(x) => x.lookup(db).container,
982-
TypeOwnerId::TypeAliasId(x) => x.lookup(db).module(db),
983-
TypeOwnerId::ImplId(x) => x.lookup(db).container,
984-
TypeOwnerId::EnumVariantId(x) => x.parent.lookup(db).container,
985-
TypeOwnerId::ModuleId(x) => *x,
975+
TypeOwnerId::FunctionId(it) => it.lookup(db).module(db),
976+
TypeOwnerId::StaticId(it) => it.lookup(db).module(db),
977+
TypeOwnerId::ConstId(it) => it.lookup(db).module(db),
978+
TypeOwnerId::InTypeConstId(it) => it.lookup(db).owner.module(db),
979+
TypeOwnerId::AdtId(it) => it.module(db),
980+
TypeOwnerId::TraitId(it) => it.lookup(db).container,
981+
TypeOwnerId::TraitAliasId(it) => it.lookup(db).container,
982+
TypeOwnerId::TypeAliasId(it) => it.lookup(db).module(db),
983+
TypeOwnerId::ImplId(it) => it.lookup(db).container,
984+
TypeOwnerId::EnumVariantId(it) => it.parent.lookup(db).container,
985+
TypeOwnerId::ModuleId(it) => *it,
986986
}
987987
}
988988
}

crates/hir-def/src/path.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub enum Path {
4545
/// Invariant: the same len as `self.mod_path.segments` or `None` if all segments are `None`.
4646
generic_args: Option<Box<[Option<Interned<GenericArgs>>]>>,
4747
},
48-
/// A link to a lang item. It is used in desugaring of things like `x?`. We can show these
48+
/// A link to a lang item. It is used in desugaring of things like `it?`. We can show these
4949
/// links via a normal path since they might be private and not accessible in the usage place.
5050
LangItem(LangItemTarget),
5151
}

crates/hir-def/src/pretty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use crate::{
1212
};
1313

1414
pub(crate) fn print_path(db: &dyn ExpandDatabase, path: &Path, buf: &mut dyn Write) -> fmt::Result {
15-
if let Path::LangItem(x) = path {
16-
return write!(buf, "$lang_item::{x:?}");
15+
if let Path::LangItem(it) = path {
16+
return write!(buf, "$lang_item::{it:?}");
1717
}
1818
match path.type_anchor() {
1919
Some(anchor) => {

0 commit comments

Comments
 (0)