Skip to content

Commit fcb0284

Browse files
authored
Migrate to 2024 edition (#294)
1 parent 0b39be0 commit fcb0284

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+955
-1071
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ authors = [
3131
version = "0.13.0-dev"
3232
publish = false
3333
repository = "https://github.com/mitmproxy/mitmproxy-rs"
34-
edition = "2021"
34+
edition = "2024"
3535
rust-version = "1.88" # MSRV
3636

3737
[workspace.dependencies]
3838
aya = { version = "0.13.0", default-features = false }
3939
aya-ebpf = { version = "0.1.1", default-features = false }
4040
aya-log = { version = "0.2.1", default-features = false }
41-
aya-log-ebpf = { version = "0.1.1", default-features = false }
41+
aya-log-ebpf = { version = "0.1.0", default-features = false }
4242
tun = { version = "0.8.5" }
4343

4444
[workspace.lints.clippy]
@@ -97,8 +97,7 @@ security-framework = "3.2.0"
9797
nix = { version = "0.30.1", default-features = false, features = ["fs"] }
9898
core-graphics = "0.25"
9999
core-foundation = "0.10"
100-
cocoa = "0.26"
101-
objc = "0.2"
100+
objc2-app-kit = { version = "0.3.2", features = ["NSRunningApplication", "NSImage", "libc"] }
102101
sysinfo = "0.36.1"
103102

104103
[target.'cfg(target_os = "linux")'.dependencies]
@@ -123,6 +122,3 @@ opt-level = 3
123122

124123
[features]
125124
tracing = ["console-subscriber"]
126-
# This feature solely exists to silence warnings caused by objc 0.2.7,
127-
# see https://github.com/SSheldon/rust-objc/issues/125
128-
cargo-clippy = []

benches/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use criterion::{criterion_group, criterion_main, Criterion};
1+
use criterion::{Criterion, criterion_group, criterion_main};
22
#[cfg(any(windows, target_os = "macos"))]
33
use mitmproxy::processes;
44

mitmproxy-contentviews/benches/contentviews.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use criterion::{criterion_group, criterion_main, Criterion};
2-
use mitmproxy_contentviews::{test::TestMetadata, MsgPack, Prettify, Protobuf, Reencode};
1+
use criterion::{Criterion, criterion_group, criterion_main};
2+
use mitmproxy_contentviews::{MsgPack, Prettify, Protobuf, Reencode, test::TestMetadata};
33
use std::hint::black_box;
44

55
fn criterion_benchmark(c: &mut Criterion) {

mitmproxy-contentviews/src/hex_dump.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ impl Prettify for HexDump {
2525
}
2626

2727
fn render_priority(&self, data: &[u8], _metadata: &dyn Metadata) -> f32 {
28-
if is_binary(data) {
29-
0.5
30-
} else {
31-
0.0
32-
}
28+
if is_binary(data) { 0.5 } else { 0.0 }
3329
}
3430
}
3531

mitmproxy-contentviews/src/hex_stream.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ impl Prettify for HexStream {
2727
}
2828

2929
fn render_priority(&self, data: &[u8], _metadata: &dyn Metadata) -> f32 {
30-
if is_binary(data) {
31-
0.4
32-
} else {
33-
0.0
34-
}
30+
if is_binary(data) { 0.4 } else { 0.0 }
3531
}
3632
}
3733

mitmproxy-contentviews/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ mod test_inspect_metadata;
77
pub use hex_dump::HexDump;
88
pub use hex_stream::HexStream;
99
pub use msgpack::MsgPack;
10-
pub use protobuf::Protobuf;
1110
pub use protobuf::GRPC;
11+
pub use protobuf::Protobuf;
1212
pub use test_inspect_metadata::TestInspectMetadata;
1313

1414
use anyhow::Result;

mitmproxy-contentviews/src/protobuf/existing_proto_definitions.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::protobuf::raw_to_proto::new_empty_descriptor;
21
use crate::Metadata;
2+
use crate::protobuf::raw_to_proto::new_empty_descriptor;
33
use anyhow::Context;
44
use protobuf::reflect::{FileDescriptor, MessageDescriptor};
55
use protobuf_parse::Parser;
@@ -89,19 +89,19 @@ fn find_best_message(
8989
}
9090

9191
let file = fds.first()?;
92-
if let Some(service) = file.services().next() {
93-
if let Some(method) = service.methods().next() {
94-
log::info!(
95-
"Falling back to first defined service in {}: {}",
96-
file.name(),
97-
service.proto().name()
98-
);
99-
return Some(if is_request {
100-
method.input_type()
101-
} else {
102-
method.output_type()
103-
});
104-
}
92+
if let Some(service) = file.services().next()
93+
&& let Some(method) = service.methods().next()
94+
{
95+
log::info!(
96+
"Falling back to first defined service in {}: {}",
97+
file.name(),
98+
service.proto().name()
99+
);
100+
return Some(if is_request {
101+
method.input_type()
102+
} else {
103+
method.output_type()
104+
});
105105
}
106106
if let Some(method) = file.messages().next() {
107107
log::info!(

mitmproxy-contentviews/src/protobuf/proto_to_yaml.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use crate::protobuf::view_protobuf::tags;
2+
use protobuf::MessageDyn;
23
/// Parsed protobuf message => YAML value
34
use protobuf::descriptor::field_descriptor_proto::Type;
45
use protobuf::descriptor::field_descriptor_proto::Type::{
56
TYPE_BYTES, TYPE_FIXED32, TYPE_FIXED64, TYPE_UINT64,
67
};
78
use protobuf::reflect::{ReflectFieldRef, ReflectValueRef};
8-
use protobuf::MessageDyn;
99
use serde_yaml::value::TaggedValue;
1010
use serde_yaml::{Mapping, Number, Value};
1111
use std::ops::Deref;

mitmproxy-contentviews/src/protobuf/raw_to_proto.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,13 @@ fn guess_field_type(
182182
parent.file_descriptor_proto().package.clone(),
183183
&format!("{}.UnknownField{}", parent.name_to_package(), field_index),
184184
);
185-
if let Ok(descriptor) = create_descriptor_proto(values[0], &existing) {
186-
if values
185+
if let Ok(descriptor) = create_descriptor_proto(values[0], &existing)
186+
&& values
187187
.iter()
188188
.skip(1)
189189
.all(|data| descriptor.descriptor_dyn().parse_from_bytes(data).is_ok())
190-
{
191-
return GuessedFieldType::Message(Box::new(descriptor));
192-
}
190+
{
191+
return GuessedFieldType::Message(Box::new(descriptor));
193192
}
194193

195194
GuessedFieldType::Unknown

0 commit comments

Comments
 (0)