Skip to content

Commit c867e12

Browse files
Change for clippy + README + stderr
1 parent 8a5ad94 commit c867e12

File tree

3 files changed

+20
-26
lines changed

3 files changed

+20
-26
lines changed

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ Arguments:
1616
1717
Options:
1818
-d, --debug
19-
--dump-ir <DUMP_IR> Dump the IR for the specified function
20-
-dt, --dump-dt <DUMP_DOM_TREE> Dump the Dominator Tree for the specified app
21-
-f, --function <FUNCTION> A specific function to scan, must be an entrypoint specified in `manifest.yml`
22-
-h, --help Print help information
23-
-V, --version Print version information
24-
--check-permissions Runs the permission checker
25-
--cached-permissions Uses cached swagger permissions to avoid redownloading them
26-
--cached-permissions-path User designated cache location, if not specified defaults to ~/.cache
27-
--graphql-schema-path <LOCATION> Uses the graphql schema in location; othwerwise selects ~/.config dir
19+
--dump-ir <DUMP_IR> Dump the IR for the specified function
20+
-dt, --dump-dt <DUMP_DOM_TREE> Dump the Dominator Tree for the specified app
21+
-f, --function <FUNCTION> A specific function to scan, must be an entrypoint specified in `manifest.yml`
22+
-h, --help Print help information
23+
-V, --version Print version information
24+
--check-permissions Runs the permission checker
25+
--cached-permissions Uses cached swagger permissions to avoid redownloading them
26+
--cached-permissions-path <LOCATION> Uses the designated cache location, otherwise selects ~/.cache dir
27+
--graphql-schema-path <LOCATION> Uses the graphql schema in location; othwerwise selects ~/.config dir
2828
```
2929

3030
## Installation

crates/forge_permission_resolver/src/permissions_cache.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ impl PermissionsCache {
6565
if duration < self.config.ttl {
6666
return true;
6767
} else {
68-
println!(
68+
eprintln!(
6969
"Cache file expired: {:?}, duration {:?} is greater than ttl {:?}",
7070
path, duration, self.config.ttl
7171
);
7272
}
7373
} else {
74-
println!("Failed to get elapsed time for cache file: {:?}", path);
74+
eprintln!("Failed to get elapsed time for cache file: {:?}", path);
7575
}
7676
} else {
77-
println!("Failed to get modified time for cache file: {:?}", path);
77+
eprintln!("Failed to get modified time for cache file: {:?}", path);
7878
}
7979
} else {
80-
println!("Failed to get metadata for cache file: {:?}", path);
80+
eprintln!("Failed to get metadata for cache file: {:?}", path);
8181
}
8282
false
8383
}

crates/forge_permission_resolver/src/serde.rs

+7-13
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,14 @@ impl From<SerializablePermissionHashMap> for PermissionHashMap {
2626
let deserialized_map: PermissionHashMap = serialized
2727
.map
2828
.into_iter()
29-
.filter_map(|(key, v)| {
29+
.map(|(key, v)| {
3030
let mut parts = key.split("::");
31-
let url = parts.next();
32-
let req = parts.next();
33-
if let (Some(url), Some(req)) = (url, req) {
34-
match req.parse::<RequestType>() {
35-
Ok(req_type) => Some(((url.to_string(), req_type), v)),
36-
Err(_) => {
37-
panic!("Failed to parse RequestType from: {}", req);
38-
}
39-
}
40-
} else {
41-
panic!("Failed to split key: {}", key);
42-
}
31+
let url = parts.next().expect("Failed to split key");
32+
let req = parts.next().expect("Failed to split key");
33+
let req_type = req
34+
.parse::<RequestType>()
35+
.expect("Failed to parse RequestType");
36+
((url.to_string(), req_type), v)
4337
})
4438
.collect();
4539
deserialized_map

0 commit comments

Comments
 (0)