Skip to content

Commit 3c3e3b3

Browse files
committed
fix: Run fmt again there were still 2 issues
1 parent 995032c commit 3c3e3b3

File tree

2 files changed

+46
-46
lines changed

2 files changed

+46
-46
lines changed

index.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class RustPlugin {
5050
strictMode: true,
5151
},
5252
(this.serverless.service.custom && this.serverless.service.custom.rust) ||
53-
{}
53+
{},
5454
);
5555

5656
// Docker can't access resources outside of the current build directory.
@@ -80,8 +80,8 @@ class RustPlugin {
8080
const targetArgs = target
8181
? ["--target", target]
8282
: MUSL_PLATFORMS.includes(platform)
83-
? ["--target", "x86_64-unknown-linux-musl"]
84-
: [];
83+
? ["--target", "x86_64-unknown-linux-musl"]
84+
: [];
8585
return [
8686
...defaultArgs,
8787
...profileArgs,
@@ -103,19 +103,19 @@ class RustPlugin {
103103
[`CC_${target || "x86_64_unknown_linux_musl"}`]: linker,
104104
}
105105
: "win32" === platform
106-
? {
107-
RUSTFLAGS: (env["RUSTFLAGS"] || "") + " -Clinker=rust-lld",
108-
TARGET_CC: "rust-lld",
109-
CC_x86_64_unknown_linux_musl: "rust-lld",
110-
}
111-
: "darwin" === platform
112-
? {
113-
RUSTFLAGS:
114-
(env["RUSTFLAGS"] || "") + " -Clinker=x86_64-linux-musl-gcc",
115-
TARGET_CC: "x86_64-linux-musl-gcc",
116-
CC_x86_64_unknown_linux_musl: "x86_64-linux-musl-gcc",
117-
}
118-
: {};
106+
? {
107+
RUSTFLAGS: (env["RUSTFLAGS"] || "") + " -Clinker=rust-lld",
108+
TARGET_CC: "rust-lld",
109+
CC_x86_64_unknown_linux_musl: "rust-lld",
110+
}
111+
: "darwin" === platform
112+
? {
113+
RUSTFLAGS:
114+
(env["RUSTFLAGS"] || "") + " -Clinker=x86_64-linux-musl-gcc",
115+
TARGET_CC: "x86_64-linux-musl-gcc",
116+
CC_x86_64_unknown_linux_musl: "x86_64-linux-musl-gcc",
117+
}
118+
: {};
119119
return {
120120
...defaultEnv,
121121
...platformEnv,
@@ -128,7 +128,7 @@ class RustPlugin {
128128
let target = (funcArgs || {}).target || this.custom.target;
129129
executable = path.join(
130130
executable,
131-
target ? target : "x86_64-unknown-linux-musl"
131+
target ? target : "x86_64-unknown-linux-musl",
132132
);
133133
}
134134
return path.join(executable, profile !== "dev" ? "release" : "debug");
@@ -138,7 +138,7 @@ class RustPlugin {
138138
return path.join(
139139
"target",
140140
"lambda",
141-
profile !== "dev" ? "release" : "debug"
141+
profile !== "dev" ? "release" : "debug",
142142
);
143143
}
144144

@@ -148,7 +148,7 @@ class RustPlugin {
148148
cargoPackage,
149149
binary,
150150
profile,
151-
platform()
151+
platform(),
152152
);
153153

154154
const env = this.localBuildEnv(funcArgs, process.env, platform());
@@ -170,7 +170,7 @@ class RustPlugin {
170170
"bootstrap",
171171
readFileSync(path.join(sourceDir, binary)),
172172
"",
173-
0o755
173+
0o755,
174174
);
175175
const targetDir = this.localArtifactDir(profile);
176176
try {
@@ -196,7 +196,7 @@ class RustPlugin {
196196
srcPath,
197197
cargoRegistry,
198198
cargoDownloads,
199-
env
199+
env,
200200
) {
201201
const defaultArgs = [
202202
"run",
@@ -252,7 +252,7 @@ class RustPlugin {
252252
this.srcPath,
253253
cargoRegistry,
254254
cargoDownloads,
255-
process.env
255+
process.env,
256256
);
257257

258258
this.serverless.cli.log("Running containerized build");
@@ -302,7 +302,7 @@ class RustPlugin {
302302
func.package = func.package || {};
303303
if (func.package.artifact && func.package.artifact !== "") {
304304
this.serverless.cli.log(
305-
`Artifact defined for ${func.handler}, skipping build...`
305+
`Artifact defined for ${func.handler}, skipping build...`,
306306
);
307307
} else {
308308
const { cargoPackage, binary } = this.cargoBinary(func);
@@ -315,7 +315,7 @@ class RustPlugin {
315315
: this.dockerBuild(func.rust, cargoPackage, binary, profile);
316316
if (res.error || res.status > 0) {
317317
this.serverless.cli.log(
318-
`Rust build encountered an error: ${res.error} ${res.status}.`
318+
`Rust build encountered an error: ${res.error} ${res.status}.`,
319319
);
320320
throw new Error(res.error);
321321
}
@@ -331,7 +331,7 @@ class RustPlugin {
331331
const artifactPath = path.join(
332332
this.srcPath,
333333
`target/lambda/${"dev" === profile ? "debug" : "release"}`,
334-
`${binary}.zip`
334+
`${binary}.zip`,
335335
);
336336
func.package = func.package || {};
337337
func.package.artifact = artifactPath;
@@ -349,7 +349,7 @@ class RustPlugin {
349349
throw new Error(
350350
`Error: no Rust functions found. ` +
351351
`Use 'runtime: ${RUST_RUNTIME}' in global or ` +
352-
`function configuration to use this plugin.`
352+
`function configuration to use this plugin.`,
353353
);
354354
}
355355
}

tests/unit/index.test.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe("RustPlugin", () => {
2020
},
2121
config: {},
2222
},
23-
{}
23+
{},
2424
);
2525

2626
it("registers expected lifecycle hooks", () => {
@@ -34,7 +34,7 @@ describe("RustPlugin", () => {
3434
it("sets sensible defaults", () => {
3535
const unconfigured = new RustPlugin(
3636
{ version: "1.71.3", service: { package: {} }, config: {} },
37-
{}
37+
{},
3838
);
3939
assert.deepEqual(unconfigured.custom, {
4040
cargoFlags: "",
@@ -63,7 +63,7 @@ describe("RustPlugin", () => {
6363
},
6464
config: {},
6565
},
66-
{}
66+
{},
6767
);
6868
assert.deepEqual(configured.custom, {
6969
cargoFlags: "--features foo",
@@ -99,7 +99,7 @@ describe("RustPlugin", () => {
9999
"--features",
100100
"foo",
101101
],
102-
"failed on linux"
102+
"failed on linux",
103103
);
104104
assert.deepEqual(
105105
plugin.localBuildArgs({}, "foo", "bar", "release", "darwin"),
@@ -113,7 +113,7 @@ describe("RustPlugin", () => {
113113
"--features",
114114
"foo",
115115
],
116-
"failed on osx"
116+
"failed on osx",
117117
);
118118
assert.deepEqual(
119119
plugin.localBuildArgs({}, "foo", "bar", "release", "win32"),
@@ -127,15 +127,15 @@ describe("RustPlugin", () => {
127127
"--features",
128128
"foo",
129129
],
130-
"failed on windows"
130+
"failed on windows",
131131
);
132132
});
133133

134134
it("configures expected localBuildEnv", () => {
135135
assert.deepEqual(
136136
plugin.localBuildEnv({}, {}, "linux"),
137137
{},
138-
"failed on linux"
138+
"failed on linux",
139139
);
140140
assert.deepEqual(
141141
plugin.localBuildEnv({}, {}, "darwin"),
@@ -145,7 +145,7 @@ describe("RustPlugin", () => {
145145
RUSTFLAGS: " -Clinker=x86_64-linux-musl-gcc",
146146
TARGET_CC: "x86_64-linux-musl-gcc",
147147
},
148-
"failed on osx"
148+
"failed on osx",
149149
);
150150
assert.deepEqual(
151151
plugin.localBuildEnv({}, {}, "win32"),
@@ -154,53 +154,53 @@ describe("RustPlugin", () => {
154154
RUSTFLAGS: " -Clinker=rust-lld",
155155
TARGET_CC: "rust-lld",
156156
},
157-
"failed on windows"
157+
"failed on windows",
158158
);
159159
});
160160

161161
it("configures expected localSourceDir", () => {
162162
assert.equal(
163163
plugin.localSourceDir({}, "dev", "linux"),
164164
path.join("target", "x86_64-unknown-linux-musl", "debug"),
165-
"failed on linux"
165+
"failed on linux",
166166
);
167167
assert.equal(
168168
plugin.localSourceDir({}, "release", "linux"),
169169
path.join("target", "x86_64-unknown-linux-musl", "release"),
170-
"failed on linux"
170+
"failed on linux",
171171
);
172172
assert.equal(
173173
plugin.localSourceDir({}, "dev", "darwin"),
174174
path.join("target", "x86_64-unknown-linux-musl", "debug"),
175-
"failed on osx"
175+
"failed on osx",
176176
);
177177
assert.equal(
178178
plugin.localSourceDir({}, "release", "darwin"),
179179
path.join("target", "x86_64-unknown-linux-musl", "release"),
180-
"failed on osx"
180+
"failed on osx",
181181
);
182182
assert.equal(
183183
plugin.localSourceDir({}, "dev", "win32"),
184184
path.join("target", "x86_64-unknown-linux-musl", "debug"),
185-
"failed on windows"
185+
"failed on windows",
186186
);
187187
assert.equal(
188188
plugin.localSourceDir({}, "release", "win32"),
189189
path.join("target", "x86_64-unknown-linux-musl", "release"),
190-
"failed on windows"
190+
"failed on windows",
191191
);
192192
});
193193

194194
it("configures expected localArtifactDir", () => {
195195
assert.equal(
196196
plugin.localArtifactDir("dev"),
197197
path.join("target", "lambda", "debug"),
198-
"failed on linux"
198+
"failed on linux",
199199
);
200200
assert.equal(
201201
plugin.localArtifactDir("release"),
202202
path.join("target", "lambda", "release"),
203-
"failed on linux"
203+
"failed on linux",
204204
);
205205
});
206206

@@ -221,7 +221,7 @@ describe("RustPlugin", () => {
221221
},
222222
config: {},
223223
},
224-
{}
224+
{},
225225
);
226226
assert(dockerless.buildLocally({}));
227227

@@ -238,7 +238,7 @@ describe("RustPlugin", () => {
238238
"source_path",
239239
"cargo_registry",
240240
"cargo_downloads",
241-
{}
241+
{},
242242
),
243243
[
244244
"run",
@@ -257,7 +257,7 @@ describe("RustPlugin", () => {
257257
"-e",
258258
"CARGO_FLAGS=--features foo -p foo",
259259
"notsoftprops/lambda-rust:latest",
260-
]
260+
],
261261
);
262262
});
263263
});

0 commit comments

Comments
 (0)