Skip to content

Commit 10a23c0

Browse files
author
Paolo Tranquilli
committed
Merge branch 'rust-experiment' into redsun82/rust-doctest-gen
2 parents 3cd8aaf + ef34d24 commit 10a23c0

File tree

203 files changed

+9439
-207
lines changed

Some content is hidden

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

203 files changed

+9439
-207
lines changed

misc/codegen/templates/rust_classes.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ impl TrapEntry for {{name}} {
3535
{{/is_repeated}}
3636
{{/is_optional}}
3737
{{#is_repeated}}
38-
for (i, &v) in self.{{field_name}}.iter().enumerate() {
38+
for (i, v) in self.{{field_name}}.into_iter().enumerate() {
3939
{{^is_optional}}
4040
out.add_tuple("{{table_name}}", vec![trap::Arg::Label(id){{^is_unordered}}, i.into(){{/is_unordered}}, v.into()]);
4141
{{/is_optional}}
4242
{{#is_optional}}
43-
if let Some(vv) = v {
43+
if let Some(v) = v {
4444
out.add_tuple("{{table_name}}", vec![trap::Arg::Label(id){{^is_unordered}}, i.into(){{/is_unordered}}, v.into()]);
4545
}
4646
{{/is_optional}}

rust/.generated.list

Lines changed: 1 addition & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/.gitattributes

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

rust/extractor/src/archive.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::path;
2-
use anyhow;
32
use log::{debug, warn};
43
use std::fs;
54
use std::path::{Path, PathBuf};

rust/extractor/src/config.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
use anyhow::Context;
2-
use clap::builder::PossibleValue;
32
use clap::{ArgAction, Parser, ValueEnum};
43
use codeql_extractor::trap;
54
use figment::{
65
providers::{Env, Serialized},
76
Figment,
87
};
9-
use serde::{Deserialize, Deserializer, Serialize, Serializer};
10-
use serde_with;
8+
use serde::{Deserialize, Serialize};
119
use std::path::PathBuf;
1210

1311
#[derive(Debug, PartialEq, Eq, Default, Serialize, Deserialize, Clone, Copy, ValueEnum)]
@@ -19,11 +17,11 @@ pub enum Compression {
1917
Gzip,
2018
}
2119

22-
impl Into<trap::Compression> for Compression {
23-
fn into(self) -> trap::Compression {
24-
match self {
25-
Compression::None => trap::Compression::None,
26-
Compression::Gzip => trap::Compression::Gzip,
20+
impl From<Compression> for trap::Compression {
21+
fn from(val: Compression) -> Self {
22+
match val {
23+
Compression::None => Self::None,
24+
Compression::Gzip => Self::Gzip,
2725
}
2826
}
2927
}
@@ -72,10 +70,10 @@ impl Config {
7270
.inputs
7371
.extend(inputs_list.split("\n").map(PathBuf::from));
7472
}
75-
Ok(Figment::new()
73+
Figment::new()
7674
.merge(Env::prefixed("CODEQL_EXTRACTOR_RUST_"))
7775
.merge(Serialized::defaults(cli_args))
7876
.extract()
79-
.context("loading configuration")?)
77+
.context("loading configuration")
8078
}
8179
}

0 commit comments

Comments
 (0)