Skip to content

Commit 9d605f2

Browse files
danieldkDaniël de Kok
authored andcommitted
Fix Clippy warnings
Clippy now warns against acronyms that are fully capitalized.
1 parent ffebc59 commit 9d605f2

File tree

8 files changed

+17
-1
lines changed

8 files changed

+17
-1
lines changed

syntaxdot-encoders/src/depseq/error.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub enum EncodeError {
1111
MissingHead { token: usize, sent: Vec<String> },
1212

1313
/// The token's head does not have a part-of-speech.
14+
#[allow(clippy::upper_case_acronyms)]
1415
MissingPOS { sent: Vec<String>, token: usize },
1516

1617
/// The token does not have a dependency relation.
@@ -102,6 +103,7 @@ pub(crate) enum DecodeError {
102103
PositionOutOfBounds,
103104

104105
/// The head part-of-speech tag does not occur in the sentence.
106+
#[allow(clippy::upper_case_acronyms)]
105107
#[error("unknown part-of-speech tag")]
106108
InvalidPOS,
107109
}

syntaxdot-encoders/src/depseq/relative_pos.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use crate::{EncodingProb, SentenceDecoder, SentenceEncoder};
2222
const ROOT_POS: &str = "ROOT";
2323

2424
/// Part-of-speech layer.
25+
#[allow(clippy::upper_case_acronyms)]
2526
#[serde(rename_all = "lowercase")]
2627
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
2728
pub enum POSLayer {
@@ -47,6 +48,7 @@ impl POSLayer {
4748
/// in terms of part-of-speech tags. For example, a position of
4849
/// *-2* with the pos *noun* means that the head is the second
4950
/// preceding noun.
51+
#[allow(clippy::upper_case_acronyms)]
5052
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
5153
pub struct RelativePOS {
5254
pos: String,
@@ -74,6 +76,7 @@ impl ToString for DependencyEncoding<RelativePOS> {
7476
/// This encoder encodes dependency relations as token labels. The
7577
/// dependency relation is encoded as-is. The position of the head
7678
/// is encoded relative to the (dependent) token by part-of-speech.
79+
#[allow(clippy::upper_case_acronyms)]
7780
#[derive(Clone, Deserialize, Eq, PartialEq, Serialize)]
7881
pub struct RelativePOSEncoder {
7982
pos_layer: POSLayer,

syntaxdot-encoders/src/lemma/edit_tree.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ impl EditTree {
9898
}
9999

100100
/// Struct representing a continuous match between two sequences.
101+
#[allow(clippy::upper_case_acronyms)]
101102
#[derive(Debug, PartialEq, Eq, Hash)]
102103
struct LCSMatch {
103104
start_src: usize,
@@ -128,7 +129,7 @@ impl PartialOrd for LCSMatch {
128129
fn longest_match(script: &[IndexedOperation<LCSOp>]) -> Option<LCSMatch> {
129130
let mut longest = LCSMatch::empty();
130131

131-
let mut script_slice = &script[..];
132+
let mut script_slice = script;
132133
while !script_slice.is_empty() {
133134
let op = &script_slice[0];
134135

syntaxdot-summary/src/record_writer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::io::{self, Write};
33
use crate::crc32::CheckSummer;
44

55
/// Write data in TFRecord format.
6+
#[allow(clippy::upper_case_acronyms)]
67
pub struct TFRecordWriter<W> {
78
checksummer: CheckSummer,
89
write: W,

syntaxdot-transformers/src/activations.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub trait Activation: Clone + FallibleModule {}
1414
/// GELU(x)=x Φ(x)
1515
///
1616
/// where Φ(x) is the CDF for the Gaussian distribution.
17+
#[allow(clippy::upper_case_acronyms)]
1718
#[derive(Clone, Copy, Debug)]
1819
pub struct GELUNew;
1920

@@ -37,6 +38,7 @@ impl Activation for GELUNew {}
3738
/// GELU(x)=x Φ(x)
3839
///
3940
/// where Φ(x) is the CDF for the Gaussian distribution.
41+
#[allow(clippy::upper_case_acronyms)]
4042
#[derive(Clone, Copy, Debug)]
4143
pub struct GELU;
4244

syntaxdot/src/encoders/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub enum DependencyEncoder {
5050
RelativePosition,
5151

5252
/// Encode a token's head by relative position of the POS tag.
53+
#[allow(clippy::upper_case_acronyms)]
5354
RelativePOS(POSLayer),
5455
}
5556

syntaxdot/src/encoders/encoders.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ pub enum DecoderError {
9292
#[error(transparent)]
9393
Layer(<LayerEncoder as SentenceDecoder>::Error),
9494

95+
#[allow(clippy::upper_case_acronyms)]
9596
#[error(transparent)]
9697
RelativePOS(<RelativePOSEncoder as SentenceDecoder>::Error),
9798

@@ -111,6 +112,7 @@ pub enum EncoderError {
111112
#[error(transparent)]
112113
Layer(<LayerEncoder as SentenceEncoder>::Error),
113114

115+
#[allow(clippy::upper_case_acronyms)]
114116
#[error(transparent)]
115117
RelativePOS(<RelativePOSEncoder as SentenceEncoder>::Error),
116118

@@ -126,6 +128,7 @@ pub enum EncoderError {
126128
pub enum Encoder {
127129
Lemma(CategoricalEncoderWrap<EditTreeEncoder, EditTree>),
128130
Layer(CategoricalEncoderWrap<LayerEncoder, String>),
131+
#[allow(clippy::upper_case_acronyms)]
129132
RelativePOS(CategoricalEncoderWrap<RelativePOSEncoder, DependencyEncoding<RelativePOS>>),
130133
RelativePosition(
131134
CategoricalEncoderWrap<RelativePositionEncoder, DependencyEncoding<RelativePosition>>,

syntaxdot/src/error.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub enum SyntaxDotError {
1515
#[error(transparent)]
1616
BertError(#[from] TransformerError),
1717

18+
#[allow(clippy::upper_case_acronyms)]
1819
#[error(transparent)]
1920
ConlluIOError(#[from] conllu::IOError),
2021

@@ -30,6 +31,7 @@ pub enum SyntaxDotError {
3031
#[error("Illegal configuration: {0}")]
3132
IllegalConfigurationError(String),
3233

34+
#[allow(clippy::upper_case_acronyms)]
3335
#[error(transparent)]
3436
IOError(#[from] io::Error),
3537

@@ -49,6 +51,7 @@ pub enum SyntaxDotError {
4951
Tch(#[from] TchError),
5052

5153
#[error(transparent)]
54+
#[allow(clippy::upper_case_acronyms)]
5255
TOMLDeserializationError(#[from] toml::de::Error),
5356

5457
#[error(transparent)]

0 commit comments

Comments
 (0)