aconfig: remove unnecessary clones
Improve performance slightly: remove unnecessary clone operations, or use references where a new object is not needed. Bug: 283910447 Test: atest aconfig.test Change-Id: I75205ffa1723dd2654039baac882c225d2653c86
This commit is contained in:
@@ -38,9 +38,9 @@ where
|
||||
let cpp_namespace = package.replace('.', "::");
|
||||
ensure!(codegen::is_valid_name_ident(&header));
|
||||
let context = Context {
|
||||
header: header.clone(),
|
||||
cpp_namespace,
|
||||
package: package.to_string(),
|
||||
header: &header,
|
||||
cpp_namespace: &cpp_namespace,
|
||||
package,
|
||||
readwrite,
|
||||
for_test: codegen_mode == CodegenMode::Test,
|
||||
class_elements,
|
||||
@@ -77,10 +77,10 @@ pub struct FileSpec<'a> {
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
pub struct Context {
|
||||
pub header: String,
|
||||
pub cpp_namespace: String,
|
||||
pub package: String,
|
||||
pub struct Context<'a> {
|
||||
pub header: &'a str,
|
||||
pub cpp_namespace: &'a str,
|
||||
pub package: &'a str,
|
||||
pub readwrite: bool,
|
||||
pub for_test: bool,
|
||||
pub class_elements: Vec<ClassElement>,
|
||||
@@ -517,7 +517,7 @@ void com_android_aconfig_test_reset_flags() {
|
||||
for file in generated {
|
||||
generated_files_map.insert(
|
||||
String::from(file.path.to_str().unwrap()),
|
||||
String::from_utf8(file.contents.clone()).unwrap(),
|
||||
String::from_utf8(file.contents).unwrap(),
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user