Skip to content

Commit f89cc11

Browse files
committed
rustdoc: s/nil/unit/ internally.
Quick poll on IRC suggested that unit was the preferred name for ().
1 parent 44ec28c commit f89cc11

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,7 @@ pub enum Primitive {
10791079
F32, F64,
10801080
Char,
10811081
Bool,
1082-
Nil,
1082+
Unit,
10831083
Str,
10841084
Slice,
10851085
PrimitiveTuple,
@@ -1110,7 +1110,7 @@ impl Primitive {
11101110
"u32" => Some(U32),
11111111
"u64" => Some(U64),
11121112
"bool" => Some(Bool),
1113-
"nil" => Some(Nil),
1113+
"unit" => Some(Unit),
11141114
"char" => Some(Char),
11151115
"str" => Some(Str),
11161116
"f32" => Some(F32),
@@ -1159,15 +1159,15 @@ impl Primitive {
11591159
Str => "str",
11601160
Bool => "bool",
11611161
Char => "char",
1162-
Nil => "()",
1162+
Unit => "()",
11631163
Slice => "slice",
11641164
PrimitiveTuple => "tuple",
11651165
}
11661166
}
11671167

11681168
pub fn to_url_str(&self) -> &'static str {
11691169
match *self {
1170-
Nil => "nil",
1170+
Unit => "unit",
11711171
other => other.to_str(),
11721172
}
11731173
}
@@ -1184,7 +1184,7 @@ impl Clean<Type> for ast::Ty {
11841184
fn clean(&self) -> Type {
11851185
use syntax::ast::*;
11861186
match self.node {
1187-
TyNil => Primitive(Nil),
1187+
TyNil => Primitive(Unit),
11881188
TyPtr(ref m) => RawPointer(m.mutbl.clean(), box m.ty.clean()),
11891189
TyRptr(ref l, ref m) =>
11901190
BorrowedRef {lifetime: l.clean(), mutability: m.mutbl.clean(),
@@ -1214,7 +1214,7 @@ impl Clean<Type> for ty::t {
12141214
fn clean(&self) -> Type {
12151215
match ty::get(*self).sty {
12161216
ty::ty_bot => Bottom,
1217-
ty::ty_nil => Primitive(Nil),
1217+
ty::ty_nil => Primitive(Unit),
12181218
ty::ty_bool => Primitive(Bool),
12191219
ty::ty_char => Primitive(Char),
12201220
ty::ty_int(ast::TyI) => Primitive(Int),

src/librustdoc/html/format.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ impl fmt::Show for clean::Type {
362362
},
363363
args = decl.decl.inputs,
364364
arrow = match decl.decl.output {
365-
clean::Primitive(clean::Nil) => "".to_string(),
365+
clean::Primitive(clean::Unit) => "".to_string(),
366366
_ => format!(" -&gt; {}", decl.decl.output),
367367
},
368368
bounds = {
@@ -411,7 +411,7 @@ impl fmt::Show for clean::Type {
411411
m.collect::<Vec<String>>().connect(" + "))
412412
},
413413
arrow = match decl.decl.output {
414-
clean::Primitive(clean::Nil) => "".to_string(),
414+
clean::Primitive(clean::Unit) => "".to_string(),
415415
_ => format!(" -&gt; {}", decl.decl.output)
416416
})
417417
}
@@ -472,7 +472,7 @@ impl fmt::Show for clean::FnDecl {
472472
write!(f, "({args}){arrow}",
473473
args = self.inputs,
474474
arrow = match self.output {
475-
clean::Primitive(clean::Nil) => "".to_string(),
475+
clean::Primitive(clean::Unit) => "".to_string(),
476476
_ => format!(" -&gt; {}", self.output),
477477
})
478478
}
@@ -505,7 +505,7 @@ impl<'a> fmt::Show for Method<'a> {
505505
write!(f, "({args}){arrow}",
506506
args = args,
507507
arrow = match d.output {
508-
clean::Primitive(clean::Nil) => "".to_string(),
508+
clean::Primitive(clean::Unit) => "".to_string(),
509509
_ => format!(" -&gt; {}", d.output),
510510
})
511511
}

0 commit comments

Comments
 (0)