Skip to content

Commit aadd3dc

Browse files
committed
Fix warnings, publish with all features
1 parent a6da7be commit aadd3dc

File tree

9 files changed

+24
-35
lines changed

9 files changed

+24
-35
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hlbc"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
edition = "2021"
55
include = ["src/**/*", "LICENSE", "README.md", "build.rs"]
66
license = "MIT"

hlbc-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hlbc-cli"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
edition = "2021"
55
license = "MIT"
66
description = "Hashlink bytecode disassembler and analyzer"

hlbc-cli/src/main.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
77

88
use hlbc::analysis::{find_fun_refs, iter_ops};
99
use hlbc::opcodes::Opcode;
10-
use hlbc::types::{Function, RefFun, RefFunPointee};
10+
use hlbc::types::{RefFun, RefFunPointee};
1111
use hlbc::*;
1212

1313
use crate::utils::read_range;
@@ -350,13 +350,16 @@ fn main() -> anyhow::Result<()> {
350350
"callgraph" => {
351351
use hlbc::analysis::graph::{call_graph, display_graph};
352352

353-
let [findex, depth] = args
353+
if let [findex, depth] = args
354354
.split(" ")
355355
.map(|s| s.parse::<usize>())
356-
.collect::<Result<Vec<_>, _>>()?;
357-
358-
let graph = call_graph(&code, RefFun(findex), depth);
359-
println!("{}", display_graph(&graph, &code));
356+
.collect::<Result<Vec<_>, _>>()?[..]
357+
{
358+
let graph = call_graph(&code, RefFun(findex), depth);
359+
println!("{}", display_graph(&graph, &code));
360+
} else {
361+
println!("Unrecognized arguments '{args}'");
362+
}
360363
}
361364
_ => {
362365
println!("Unknown command : '{line}'");

hlbc-cli/src/utils.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
use std::iter::repeat;
2-
3-
use hlbc::opcodes::Opcode;
4-
use hlbc::types::{Function, RefFun};
5-
use hlbc::Bytecode;
6-
71
// TODO refactor this
82
pub fn read_range(arg: &str, max_bound: usize) -> anyhow::Result<Box<dyn Iterator<Item = usize>>> {
93
if arg == ".." {

hlbc-derive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hlbc-derive"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
edition = "2021"
55
license = "MIT"
66
description = "Procedural macros for the 'hlbc' crate"

hlbc-derive/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use syn::__private::TokenStream2;
55
use syn::{Data, DeriveInput, GenericArgument, Ident, PathArguments, Type, Variant};
66

77
#[proc_macro_attribute]
8-
pub fn gen_decode(attr: TokenStream, input: TokenStream) -> TokenStream {
8+
pub fn gen_decode(_: TokenStream, input: TokenStream) -> TokenStream {
99
let ast = syn::parse_macro_input!(input as DeriveInput);
1010
let variants = match &ast.data {
1111
Data::Enum(v) => Some(&v.variants),
@@ -65,11 +65,11 @@ fn ident(ty: &Type) -> String {
6565
PathArguments::AngleBracketed(a) => {
6666
let a = match &a.args[0] {
6767
GenericArgument::Type(ty) => ident(ty),
68-
other => unreachable!(),
68+
_ => unreachable!(),
6969
};
7070
format!("{}<{}>", seg.ident, a)
7171
}
72-
other => unreachable!(),
72+
_ => unreachable!(),
7373
}
7474
}
7575
other => unreachable!("unkown type {:?}", other),
@@ -150,7 +150,7 @@ fn gen_initr(enum_name: &Ident, v: &Variant) -> TokenStream2 {
150150
"RefEnumConstruct" => quote! {
151151
RefEnumConstruct(#rvi32 as usize)
152152
},
153-
other => TokenStream2::default(),
153+
_ => TokenStream2::default(),
154154
});
155155
quote! {
156156
Ok(#enum_name::#vname {
@@ -221,7 +221,7 @@ fn gen_initw(enum_name: &Ident, v: &Variant, i: u8) -> TokenStream2 {
221221
"RefEnumConstruct" => quote! {
222222
w.write_vi32(#fname.0 as i32)?;
223223
},
224-
other => TokenStream2::default(),
224+
_ => TokenStream2::default(),
225225
}
226226
});
227227
quote! {

src/analysis/graph.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
use std::fmt;
22
use std::fmt::{Display, Formatter};
33

4-
use petgraph::dot::Dot;
5-
use petgraph::graph::NodeIndex;
6-
use petgraph::graphmap::{DiGraphMap, GraphMap};
7-
use petgraph::visit::{
8-
EdgeRef, GraphProp, IntoEdgeReferences, IntoNodeReferences, NodeIndexable, NodeRef,
9-
};
4+
use crate::analysis::find_calls;
5+
use petgraph::graphmap::DiGraphMap;
6+
use petgraph::visit::{EdgeRef, IntoEdgeReferences, IntoNodeReferences, NodeIndexable, NodeRef};
107

11-
use crate::r#mod::find_calls;
128
use crate::types::{Function, RefFun, RefFunPointee};
139
use crate::Bytecode;
14-
use crate::Opcode;
15-
16-
use crate::r#mod::iter_ops;
17-
use crate::utils::find_calls;
1810

1911
type Callgraph = DiGraphMap<RefFun, ()>;
2012

src/fmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ impl Opcode {
453453
Opcode::SetEnumField { value, field, src } => {
454454
op!("{value}.{} = {src}", field.0)
455455
}
456-
other => format!("{self:?}"),
456+
_ => format!("{self:?}"),
457457
}
458458
}
459459
}

0 commit comments

Comments
 (0)