Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clippy fixes. #1199

Merged
merged 2 commits into from
Dec 17, 2022
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
2 changes: 1 addition & 1 deletion engine/src/conversion/analysis/fun/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ impl<'a> FnAnalyzer<'a> {
} else {
"_"
};
cxxbridge_name = make_ident(&format!("{}{}autocxx_wrapper", cxxbridge_name, joiner));
cxxbridge_name = make_ident(format!("{}{}autocxx_wrapper", cxxbridge_name, joiner));
let (payload, cpp_function_kind) = match fun.synthetic_cpp.as_ref().cloned() {
Some((payload, cpp_function_kind)) => (payload, cpp_function_kind),
None => match kind {
Expand Down
2 changes: 1 addition & 1 deletion engine/src/conversion/analysis/type_converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ impl<'a> TypeConverter<'a> {
Some(_) => format!("AutocxxConcrete{}", count),
};
let api = UnanalyzedApi::ConcreteType {
name: ApiName::new_in_root_namespace(make_ident(&synthetic_ident)),
name: ApiName::new_in_root_namespace(make_ident(synthetic_ident)),
cpp_definition: cpp_definition.clone(),
rs_definition: Some(Box::new(rs_definition.clone())),
};
Expand Down
2 changes: 1 addition & 1 deletion engine/src/conversion/codegen_rs/non_pod_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub(crate) fn make_non_pod(s: &mut ItemStruct, layout: Option<Layout>) {
.filter_map(|(counter, gp)| match gp {
GenericParam::Type(gpt) => {
let id = &gpt.ident;
let field_name = make_ident(&format!("_phantom_{}", counter));
let field_name = make_ident(format!("_phantom_{}", counter));
let toks = quote! {
#field_name: ::std::marker::PhantomData<::std::cell::UnsafeCell< #id >>
};
Expand Down
6 changes: 3 additions & 3 deletions engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ impl IncludeCppEngine {
"header": header,
"config": config
});
let f = File::create(&output_path).unwrap();
let f = File::create(output_path).unwrap();
serde_json::to_writer(f, &json).unwrap();
}
}
Expand Down Expand Up @@ -721,10 +721,10 @@ pub struct CppCodegenOptions<'a> {
/// You may wish to do this to make a hermetic test case with no
/// external dependencies.
pub suppress_system_headers: bool,
/// Optionally, a prefix to go at `#include "<here>cxx.h". This is a header file from the `cxx`
/// Optionally, a prefix to go at `#include "*here*cxx.h". This is a header file from the `cxx`
/// crate.
pub path_to_cxx_h: Option<String>,
/// Optionally, a prefix to go at `#include "<here>cxxgen.h". This is a header file which we
/// Optionally, a prefix to go at `#include "*here*cxxgen.h". This is a header file which we
/// generate.
pub path_to_cxxgen_h: Option<String>,
/// Optionally, a function called to determine the name that will be used
Expand Down
4 changes: 2 additions & 2 deletions gen/cmd/tests/cmd_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ fn test_gen_repro() -> Result<(), Box<dyn std::error::Error>> {

fn write_to_file(dir: &Path, filename: &str, content: &[u8]) {
let path = dir.join(filename);
let mut f = File::create(&path).expect("Unable to create file");
let mut f = File::create(path).expect("Unable to create file");
f.write_all(content).expect("Unable to write file");
}

Expand Down Expand Up @@ -350,7 +350,7 @@ fn assert_not_contentful(outdir: &TempDir, fname: &str) {

fn assert_contains(outdir: &TempDir, fname: &str, pattern: &str) {
let p = outdir.path().join(fname);
let content = std::fs::read_to_string(&p).expect(fname);
let content = std::fs::read_to_string(p).expect(fname);
eprintln!("content = {}", content);
assert!(content.contains(pattern));
}
2 changes: 1 addition & 1 deletion tools/reduce/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ fn do_run(matches: ArgMatches, tmp_dir: &TempDir) -> Result<(), std::io::Error>
match output_path {
None => print_minimized_case(&concat_path)?,
Some(output_path) => {
std::fs::copy(&concat_path, &PathBuf::from(output_path))?;
std::fs::copy(&concat_path, PathBuf::from(output_path))?;
}
};
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion tools/reduce/tests/reduce_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ where

fn write_to_file(dir: &Path, filename: &str, content: &[u8]) {
let path = dir.join(filename);
let mut f = File::create(&path).expect("Unable to create file");
let mut f = File::create(path).expect("Unable to create file");
f.write_all(content).expect("Unable to write file");
}

Expand Down