Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rust-101
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
orestis.malaspin
rust-101
Commits
ca9acfde
Commit
ca9acfde
authored
7 months ago
by
orestis.malaspin
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix_formatting' into 'main'
Fix formatting See merge request
!78
parents
7678a15c
6a6c590a
No related branches found
Branches containing commit
No related tags found
1 merge request
!78
Fix formatting
Pipeline
#33816
passed
7 months ago
Stage: test
Stage: build
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
codes/rust_lang/cli/src/io.rs
+17
-18
17 additions, 18 deletions
codes/rust_lang/cli/src/io.rs
codes/rust_lang/unsafe/src/main.rs
+1
-1
1 addition, 1 deletion
codes/rust_lang/unsafe/src/main.rs
with
18 additions
and
19 deletions
codes/rust_lang/cli/src/io.rs
+
17
−
18
View file @
ca9acfde
...
...
@@ -59,7 +59,7 @@ fn write_to_file(output: &str, numbers: &[i32]) -> Result<(), String> {
/// these numbers. Returns errors when the parsing fails.
pub
fn
read_command_line_builder
()
->
Result
<
(),
String
>
{
// ANCHOR: matches
let
matches
=
let
matches
=
// ANCHOR: new_command
Command
::
new
(
COMMAND
)
.author
(
AUTHOR
)
...
...
@@ -97,29 +97,28 @@ pub fn read_command_line_builder() -> Result<(), String> {
// ANCHOR_END: matches
// ANCHOR: numbers_matches
let
numbers
=
if
let
Some
(
count
)
=
let
numbers
=
if
let
Some
(
count
)
=
// ANCHOR: get_one_matches
matches
.get_one
::
<
usize
>
(
"count"
)
// ANCHOR_END: get_one_matches
{
read_from_urandom
(
*
count
)
?
}
else
if
let
Some
(
numbers
)
=
matches
.get_one
::
<
usize
>
(
"count"
)
// ANCHOR_END: get_one_matches
{
read_from_urandom
(
*
count
)
?
}
else
if
let
Some
(
numbers
)
=
// ANCHOR: get_many_matches
matches
.get_many
::
<
i32
>
(
"numbers"
)
// ANCHOR_END: get_many_matches
{
numbers
.copied
()
.collect
()
}
else
{
Vec
::
new
()
};
matches
.get_many
::
<
i32
>
(
"numbers"
)
// ANCHOR_END: get_many_matches
{
numbers
.copied
()
.collect
()
}
else
{
Vec
::
new
()
};
// ANCHOR_END: numbers_matches
// ANCHOR: output_matches
if
let
Some
(
output
)
=
if
let
Some
(
output
)
=
// ANCHOR: get_one_string_matches
matches
.get_one
::
<
String
>
(
"output"
)
// ANCHOR_END: get_one_string_matches
matches
.get_one
::
<
String
>
(
"output"
)
// ANCHOR_END: get_one_string_matches
{
write_to_file
(
output
,
&
numbers
)
?
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
codes/rust_lang/unsafe/src/main.rs
+
1
−
1
View file @
ca9acfde
...
...
@@ -38,7 +38,7 @@ fn main() {
safe_list
.print
();
unsafe_list
.print
();
for
j
in
1
..
1000
{
for
_
j
in
1
..
1000
{
let
mut
ul
=
UnsafeList
::
new
();
for
i
in
1
..
1_000_000
{
ul
.push
(
i
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment