Skip to content

Commit

Permalink
Use i32 rather than usize as "default integer" in library template
Browse files Browse the repository at this point in the history
`usize` was renamed from `uint` in order to convey that it's not the
"default integer type". Guide new users to use `i32` instead of `usize`.
  • Loading branch information
tbu- committed May 20, 2024
1 parent 84dc5dc commit 8ad3510
Show file tree
Hide file tree
Showing 30 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/cargo/ops/cargo_new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ fn main() {
"
} else {
b"\
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/cargo_init/auto_git/out/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/cargo_init/formats_source/out/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/cargo_init/git_autodetect/out/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/cargo_init/pijul_autodetect/out/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/cargo_init/simple_git/out/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/cargo_init/simple_hg/out/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/cargo_init/simple_lib/out/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub fn add(left: usize, right: usize) -> usize {
pub fn add(left: i32, right: i32) -> i32 {
left + right
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn simple_lib() {
let contents = fs::read_to_string(&lib).unwrap();
assert_eq!(
contents,
r#"pub fn add(left: usize, right: usize) -> usize {
r#"pub fn add(left: i32, right: i32) -> i32 {
left + right
}
Expand Down

0 comments on commit 8ad3510

Please sign in to comment.