Skip to content

Commit 9d0a348

Browse files
committed
clippy::use_self
1 parent c0201c7 commit 9d0a348

26 files changed

Lines changed: 176 additions & 172 deletions

File tree

crates/stackable-operator/src/builder/configmap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ pub struct ConfigMapBuilder {
1919
}
2020

2121
impl ConfigMapBuilder {
22-
pub fn new() -> ConfigMapBuilder {
23-
ConfigMapBuilder::default()
22+
pub fn new() -> Self {
23+
Self::default()
2424
}
2525

2626
pub fn metadata_default(&mut self) -> &mut Self {

crates/stackable-operator/src/builder/event.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl EventBuilder {
3434
/// # Arguments
3535
///
3636
/// - `resource` - The resource for which this event is created, will be used to create the `involvedObject` and `metadata.name` fields
37-
pub fn new<T>(resource: &T) -> EventBuilder
37+
pub fn new<T>(resource: &T) -> Self
3838
where
3939
T: Resource<DynamicType = ()>,
4040
{
@@ -48,10 +48,10 @@ impl EventBuilder {
4848
uid: resource.meta().uid.clone(),
4949
};
5050

51-
EventBuilder {
51+
Self {
5252
name: resource.name_any(),
5353
involved_object,
54-
..EventBuilder::default()
54+
..Self::default()
5555
}
5656
}
5757

crates/stackable-operator/src/builder/meta.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ pub struct ObjectMetaBuilder {
3434
}
3535

3636
impl ObjectMetaBuilder {
37-
pub fn new() -> ObjectMetaBuilder {
38-
ObjectMetaBuilder::default()
37+
pub fn new() -> Self {
38+
Self::default()
3939
}
4040

4141
/// This sets the name and namespace from a given resource
@@ -228,8 +228,8 @@ pub struct OwnerReferenceBuilder {
228228
}
229229

230230
impl OwnerReferenceBuilder {
231-
pub fn new() -> OwnerReferenceBuilder {
232-
OwnerReferenceBuilder::default()
231+
pub fn new() -> Self {
232+
Self::default()
233233
}
234234

235235
pub fn api_version(&mut self, api_version: impl Into<String>) -> &mut Self {

crates/stackable-operator/src/builder/pdb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub enum PodDisruptionBudgetConstraint {
5959

6060
impl PodDisruptionBudgetBuilder<(), (), ()> {
6161
pub fn new() -> Self {
62-
PodDisruptionBudgetBuilder::default()
62+
Self::default()
6363
}
6464

6565
/// This method populates [`PodDisruptionBudget::metadata`] and

crates/stackable-operator/src/builder/pod/container.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ pub struct ContainerBuilder {
6767
impl ContainerBuilder {
6868
pub fn new(name: &str) -> Result<Self> {
6969
Self::validate_container_name(name)?;
70-
Ok(ContainerBuilder {
70+
Ok(Self {
7171
name: name.to_string(),
72-
..ContainerBuilder::default()
72+
..Self::default()
7373
})
7474
}
7575

@@ -371,9 +371,9 @@ pub struct ContainerPortBuilder {
371371

372372
impl ContainerPortBuilder {
373373
pub fn new(container_port: i32) -> Self {
374-
ContainerPortBuilder {
374+
Self {
375375
container_port,
376-
..ContainerPortBuilder::default()
376+
..Self::default()
377377
}
378378
}
379379

@@ -422,11 +422,11 @@ pub enum FieldPathEnvVar {
422422
impl fmt::Display for FieldPathEnvVar {
423423
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
424424
match self {
425-
FieldPathEnvVar::Name => write!(f, "metadata.name"),
426-
FieldPathEnvVar::Namespace => write!(f, "metadata.namespace"),
427-
FieldPathEnvVar::UID => write!(f, "metadata.uid"),
428-
FieldPathEnvVar::Labels(name) => write!(f, "metadata.labels['{name}']"),
429-
FieldPathEnvVar::Annotations(name) => write!(f, "metadata.annotations['{name}']"),
425+
Self::Name => write!(f, "metadata.name"),
426+
Self::Namespace => write!(f, "metadata.namespace"),
427+
Self::UID => write!(f, "metadata.uid"),
428+
Self::Labels(name) => write!(f, "metadata.labels['{name}']"),
429+
Self::Annotations(name) => write!(f, "metadata.annotations['{name}']"),
430430
}
431431
}
432432
}

crates/stackable-operator/src/builder/pod/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ pub struct PodBuilder {
8888
}
8989

9090
impl PodBuilder {
91-
pub fn new() -> PodBuilder {
92-
PodBuilder::default()
91+
pub fn new() -> Self {
92+
Self::default()
9393
}
9494

9595
pub fn service_account_name(&mut self, value: impl Into<String>) -> &mut Self {

crates/stackable-operator/src/builder/pod/resources.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub struct ResourceRequirementsBuilder<CR, CL, MR, ML> {
2424

2525
impl ResourceRequirementsBuilder<(), (), (), ()> {
2626
pub fn new() -> Self {
27-
ResourceRequirementsBuilder::default()
27+
Self::default()
2828
}
2929
}
3030

crates/stackable-operator/src/builder/pod/security.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ impl SecurityContextBuilder {
1818
}
1919
}
2020

21-
pub fn new() -> SecurityContextBuilder {
22-
SecurityContextBuilder::default()
21+
pub fn new() -> Self {
22+
Self::default()
2323
}
2424

2525
pub fn allow_privilege_escalation(&mut self, value: bool) -> &mut Self {
@@ -150,8 +150,8 @@ pub struct PodSecurityContextBuilder {
150150
}
151151

152152
impl PodSecurityContextBuilder {
153-
pub fn new() -> PodSecurityContextBuilder {
154-
PodSecurityContextBuilder::default()
153+
pub fn new() -> Self {
154+
Self::default()
155155
}
156156

157157
pub fn build(&self) -> PodSecurityContext {

crates/stackable-operator/src/builder/pod/volume.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ impl Default for VolumeSource {
4848
}
4949

5050
impl VolumeBuilder {
51-
pub fn new(name: impl Into<String>) -> VolumeBuilder {
52-
VolumeBuilder {
51+
pub fn new(name: impl Into<String>) -> Self {
52+
Self {
5353
name: name.into(),
54-
..VolumeBuilder::default()
54+
..Self::default()
5555
}
5656
}
5757

@@ -222,11 +222,11 @@ pub struct VolumeMountBuilder {
222222
}
223223

224224
impl VolumeMountBuilder {
225-
pub fn new(name: impl Into<String>, mount_path: impl Into<String>) -> VolumeMountBuilder {
226-
VolumeMountBuilder {
225+
pub fn new(name: impl Into<String>, mount_path: impl Into<String>) -> Self {
226+
Self {
227227
mount_path: mount_path.into(),
228228
name: name.into(),
229-
..VolumeMountBuilder::default()
229+
..Self::default()
230230
}
231231
}
232232

@@ -428,10 +428,10 @@ impl ListenerReference {
428428
/// Return the key and value for a Kubernetes object annotation
429429
fn to_annotation(&self) -> Result<Annotation, AnnotationError> {
430430
match self {
431-
ListenerReference::ListenerClass(class) => {
431+
Self::ListenerClass(class) => {
432432
Annotation::try_from(("listeners.stackable.tech/listener-class", class.as_str()))
433433
}
434-
ListenerReference::ListenerName(name) => {
434+
Self::ListenerName(name) => {
435435
Annotation::try_from(("listeners.stackable.tech/listener-name", name.as_str()))
436436
}
437437
}
@@ -493,7 +493,7 @@ impl ListenerOperatorVolumeSourceBuilder {
493493
pub fn new(
494494
listener_reference: &ListenerReference,
495495
labels: &Labels,
496-
) -> ListenerOperatorVolumeSourceBuilder {
496+
) -> Self {
497497
Self {
498498
listener_reference: listener_reference.to_owned(),
499499
labels: labels.to_owned(),

crates/stackable-operator/src/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl Client {
113113
default_namespace: String,
114114
kubernetes_cluster_info: KubernetesClusterInfo,
115115
) -> Self {
116-
Client {
116+
Self {
117117
client,
118118
post_params: PostParams {
119119
field_manager: field_manager.clone(),

0 commit comments

Comments
 (0)