Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
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
nodes
rust
Duniter v2S
Commits
8bc5e17f
Commit
8bc5e17f
authored
2 years ago
by
Éloïs
Browse files
Options
Downloads
Patches
Plain Diff
style(xtask): fix rustc warnings
parent
69e36c14
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xtask/src/main.rs
+5
-6
5 additions, 6 deletions
xtask/src/main.rs
with
5 additions
and
6 deletions
xtask/src/main.rs
+
5
−
6
View file @
8bc5e17f
...
...
@@ -18,7 +18,7 @@ mod gen_calls_doc;
use
anyhow
::{
Context
,
Result
};
use
clap
::
Parser
;
use
std
::
io
::{
BufReader
,
BufWriter
,
Read
,
Write
};
use
std
::
io
::{
BufReader
,
BufWriter
};
use
std
::
path
::{
Path
,
PathBuf
};
use
std
::
process
::
Command
;
...
...
@@ -82,13 +82,12 @@ fn inject_runtime_code(raw_spec: &Path, runtime: &Path) -> Result<()> {
// Read runtime code
// SAFETY: `mmap` is fundamentally unsafe since technically the file can change
// underneath us while it is mapped; in practice it's unlikely to be a problem
let
mut
file
=
std
::
fs
::
File
::
open
(
runtime
)
.with_context
(||
"Failed to open runtime wasm file"
)
?
;
let
mut
runtime_code
=
let
file
=
std
::
fs
::
File
::
open
(
runtime
)
.with_context
(||
"Failed to open runtime wasm file"
)
?
;
let
runtime_code
=
unsafe
{
memmap2
::
Mmap
::
map
(
&
file
)
.with_context
(||
"Failed to read runtime wasm file"
)
?
};
// Read raw spec
let
mut
file
=
std
::
fs
::
File
::
open
(
raw_spec
)
.with_context
(||
"Failed to open raw spec file"
)
?
;
let
file
=
std
::
fs
::
File
::
open
(
raw_spec
)
.with_context
(||
"Failed to open raw spec file"
)
?
;
let
reader
=
BufReader
::
new
(
file
);
let
mut
json
:
serde_json
::
Value
=
serde_json
::
from_reader
(
reader
)
.with_context
(||
"Failed to read raw spec file"
)
?
;
...
...
@@ -124,7 +123,7 @@ fn inject_runtime_code(raw_spec: &Path, runtime: &Path) -> Result<()> {
// Write modified raw specs
let
mut
file
=
std
::
fs
::
File
::
create
(
raw_spec
)
?
;
let
file
=
std
::
fs
::
File
::
create
(
raw_spec
)
?
;
serde_json
::
to_writer_pretty
(
BufWriter
::
new
(
file
),
&
json
)
.with_context
(||
"fail to write raw specs"
)
?
;
...
...
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