Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ jobs:

- uses: Swatinem/rust-cache@v2

- name: Rustfmt
run: cargo fmt --all --check

- name: Clippy
run: cargo clippy --workspace -- -D warnings
run: cargo clippy --workspace --all-targets -- -D warnings

- name: Tests
run: cargo test --workspace
Expand Down Expand Up @@ -72,7 +75,7 @@ jobs:
- uses: Swatinem/rust-cache@v2

- name: Check (MSRV 1.85)
run: cargo check --workspace
run: cargo check --workspace --all-targets

# ── no_std and 32-bit compilation checks ─────────────────────────────────
check-nostd:
Expand Down
5 changes: 3 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ tasks:
- cargo test -p buffa-codegen --test codegen_integration

lint:
desc: Run clippy across the workspace with warnings as errors.
desc: Run rustfmt check and clippy (all targets) with warnings as errors.
cmds:
- cargo clippy --workspace -- -D warnings
- cargo fmt --all --check
- cargo clippy --workspace --all-targets -- -D warnings

lint-md:
desc: >-
Expand Down
21 changes: 12 additions & 9 deletions buffa-codegen/src/comments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,14 +559,17 @@ mod tests {
enums: Vec<EnumDescriptorProto>,
locations: Vec<Location>,
) -> FileDescriptorProto {
let mut file = FileDescriptorProto::default();
file.package = Some(package.to_string());
file.message_type = messages;
file.enum_type = enums;
let mut sci = SourceCodeInfo::default();
sci.location = locations;
file.source_code_info = sci.into();
file
FileDescriptorProto {
package: Some(package.to_string()),
message_type: messages,
enum_type: enums,
source_code_info: SourceCodeInfo {
location: locations,
..Default::default()
}
.into(),
..Default::default()
}
}

fn make_field(name: &str) -> FieldDescriptorProto {
Expand Down Expand Up @@ -806,7 +809,7 @@ mod tests {
vec![make_location(vec![4, 0], Some(" \n "), Some(" "))],
);
let map = fqn_comments(&file);
assert!(map.get("pkg.Msg").is_none());
assert!(!map.contains_key("pkg.Msg"));
}

#[test]
Expand Down
18 changes: 12 additions & 6 deletions buffa-codegen/src/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,10 @@ mod tests {
/// `text_ident` is dropped.
fn gen_with(field: &FieldDescriptorProto, json: bool) -> Option<(String, Option<String>)> {
let files: [FileDescriptorProto; 0] = [];
let mut config = CodeGenConfig::default();
config.generate_json = json;
let config = CodeGenConfig {
generate_json: json,
..Default::default()
};
let ctx = CodeGenContext::new(&files, &config, &[]);
let features = ResolvedFeatures::proto2_defaults();
generate_one(&ctx, field, "", 0, &features, "my.pkg")
Expand Down Expand Up @@ -636,8 +638,10 @@ mod tests {
}],
..Default::default()
}];
let mut config = CodeGenConfig::default();
config.generate_json = true;
let config = CodeGenConfig {
generate_json: true,
..Default::default()
};
let ctx = CodeGenContext::new(&files, &config, &[]);
let features = ResolvedFeatures::proto2_defaults();
generate_one(&ctx, field, "my.pkg", 0, &features, "my.pkg")
Expand Down Expand Up @@ -778,8 +782,10 @@ mod tests {
}],
..Default::default()
}];
let mut config = CodeGenConfig::default();
config.generate_text = true;
let config = CodeGenConfig {
generate_text: true,
..Default::default()
};
let ctx = CodeGenContext::new(&files, &config, &[]);
let features = ResolvedFeatures::proto2_defaults();
let mut field = ext_field("ann", 50007, Type::TYPE_MESSAGE);
Expand Down
2 changes: 1 addition & 1 deletion buffa-codegen/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ mod tests {
.iter()
.filter(|d| {
d.edition
.map_or(false, |e| (e as i32) <= (target_edition as i32))
.is_some_and(|e| (e as i32) <= (target_edition as i32))
})
.last()
.unwrap_or_else(|| panic!("no defaults entry for edition {target_edition:?}"));
Expand Down
Loading
Loading