Skip to content

Commit

Permalink
app/*: obey clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
waynr committed Apr 9, 2023
1 parent b808103 commit a58548a
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 41 deletions.
6 changes: 2 additions & 4 deletions app/chrome/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ impl aspects::ContainerAspect for Chrome {
vec![
aspects::DockerfileSnippet {
order: 91,
content: format!(
r#"
content: r#"
ADD https://dl.google.com/linux/direct/google-talkplugin_current_amd64.deb /src/google-talkplugin_current_amd64.deb
RUN apt-get update && apt-get install -y --no-install-recommends \
libpango1.0-0 \
Expand All @@ -36,8 +35,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& dpkg -i /src/google-talkplugin_current_amd64.deb \
&& apt-get purge --auto-remove -y curl \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /src/*.deb"#,
),
&& rm -rf /src/*.deb"#.to_string(),
},
aspects::DockerfileSnippet {
order: 75,
Expand Down
6 changes: 2 additions & 4 deletions app/discord/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@ impl aspects::ContainerAspect for Discord {
vec![
aspects::DockerfileSnippet {
order: 91,
content: format!(
r#"WORKDIR /opt/
content: r#"WORKDIR /opt/
RUN curl https://dl.discordapp.net/apps/linux/0.0.25/discord-0.0.25.deb > /opt/discord.deb && \
dpkg --force-depends -i /opt/discord.deb ; rm /opt/discord.deb
RUN apt-get update && apt-get --fix-broken install -y \
&& apt-get purge --autoremove \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /src/*.deb "#,
),
&& rm -rf /src/*.deb "#.to_string(),
},
aspects::DockerfileSnippet {
order: 92,
Expand Down
2 changes: 1 addition & 1 deletion app/firefox/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use dfiles::containermanager::ContainerManager;
#[derive(Clone)]
struct Firefox {}

const VERSION: &'static str = "109.0.1";
const VERSION: &str = "109.0.1";

impl aspects::ContainerAspect for Firefox {
fn name(&self) -> String {
Expand Down
12 changes: 4 additions & 8 deletions app/skype/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ RUN chmod 644 /etc/fonts/local.conf"#,
},
aspects::DockerfileSnippet {
order: 91,
content: format!(
r#"# Add the skype debian repo
content: r#"# Add the skype debian repo
RUN curl -sSL https://repo.skype.com/data/SKYPE-GPG-KEY | apt-key add -
RUN echo "deb [arch=amd64] https://repo.skype.com/deb stable main" > /etc/apt/sources.list.d/skype.list
Expand All @@ -35,15 +34,12 @@ RUN apt-get update && apt-get -y install \
skypeforlinux \
&& apt-get purge --autoremove \
&& rm -rf /var/lib/apt/lists/*
"#,
),
"#.to_string(),
},
aspects::DockerfileSnippet {
order: 92,
content: format!(
r#"COPY /run-skype-and-wait-for-exit /usr/local/bin
RUN chmod 755 /usr/local/bin/run-skype-and-wait-for-exit"#,
),
content: r#"COPY /run-skype-and-wait-for-exit /usr/local/bin
RUN chmod 755 /usr/local/bin/run-skype-and-wait-for-exit"#.to_string(),
},
]
}
Expand Down
6 changes: 2 additions & 4 deletions app/steam/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,14 @@ impl aspects::ContainerAspect for Steam {
fn dockerfile_snippets(&self) -> Vec<aspects::DockerfileSnippet> {
vec![aspects::DockerfileSnippet {
order: 91,
content: format!(
r#"RUN dpkg --add-architecture i386
content: r#"RUN dpkg --add-architecture i386
RUN sed -i -e 's|main|main contrib non-free|' /etc/apt/sources.list
RUN apt-get update && yes 'I AGREE' | apt-get install -y \
steam \
&& apt-get purge --autoremove \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /src/*.deb
RUN chmod 4755 /opt/Signal/chrome-sandox"#,
),
RUN chmod 4755 /opt/Signal/chrome-sandox"#.to_string(),
}]
}
}
Expand Down
6 changes: 2 additions & 4 deletions app/thinkorswim/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ impl aspects::ContainerAspect for Thinkorswim {
vec![
aspects::DockerfileSnippet {
order: 90,
content: format!(
r#"
content: r#"
RUN apt-get update && apt-get install -y --no-install-recommends \
openjdk-11-jre \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /src/*.deb"#,
),
&& rm -rf /src/*.deb"#.to_string(),
},
aspects::DockerfileSnippet {
order: 91,
Expand Down
6 changes: 2 additions & 4 deletions app/zoom/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ impl aspects::ContainerAspect for Zoom {
fn dockerfile_snippets(&self) -> Vec<aspects::DockerfileSnippet> {
vec![aspects::DockerfileSnippet {
order: 91,
content: format!(
r#"WORKDIR /opt/
content: r#"WORKDIR /opt/
RUN curl -L https://zoom.us/client/latest/zoom_amd64.deb -o /opt/zoom_amd64.deb && \
dpkg --force-depends -i /opt/zoom_amd64.deb && rm /opt/zoom_amd64.deb
RUN apt-get update && apt-get --fix-broken install -y \
&& apt-get purge --autoremove \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /src/*.deb "#,
),
&& rm -rf /src/*.deb "#.to_string(),
}]
}
}
Expand Down
24 changes: 12 additions & 12 deletions src/dfiles/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,17 +269,17 @@ mod merge_should {
);

assert_eq!(
merge(&Some(left.clone()), &empty.clone(), false),
merge(&Some(left.clone()), &empty, false),
Some(vec![1, 2, 3, 4])
);
assert_eq!(merge(&Some(left.clone()), &empty.clone(), true), None);
assert_eq!(merge(&Some(left), &empty, true), None);

assert_eq!(
merge(&empty.clone(), &Some(right.clone()), false),
merge(&empty, &Some(right.clone()), false),
Some(vec![5, 6, 7])
);
assert_eq!(
merge(&empty.clone(), &Some(right.clone()), true),
merge(&empty, &Some(right), true),
Some(vec![5, 6, 7])
);
}
Expand All @@ -289,16 +289,16 @@ mod merge_should {
let none: Option<Vec<i32>> = None;
let empty: Option<Vec<i32>> = Some(Vec::new());

assert_eq!(merge(&none.clone(), &none.clone(), true), None);
assert_eq!(merge(&none.clone(), &none.clone(), false), None);
assert_eq!(merge(&none, &none, true), None);
assert_eq!(merge(&none, &none, false), None);

assert_eq!(merge(&none.clone(), &empty.clone(), true), None);
assert_eq!(merge(&none.clone(), &empty.clone(), false), None);
assert_eq!(merge(&none, &empty, true), None);
assert_eq!(merge(&none, &empty, false), None);

assert_eq!(merge(&empty.clone(), &empty.clone(), true), None);
assert_eq!(merge(&empty.clone(), &empty.clone(), false), None);
assert_eq!(merge(&empty, &empty, true), None);
assert_eq!(merge(&empty, &empty, false), None);

assert_eq!(merge(&empty.clone(), &none.clone(), true), None);
assert_eq!(merge(&empty.clone(), &none.clone(), false), None);
assert_eq!(merge(&empty, &none, true), None);
assert_eq!(merge(&empty, &none, false), None);
}
}

0 comments on commit a58548a

Please sign in to comment.