Skip to content

Commit c588702

Browse files
committed
Merge branch 'master' into next-release-devel
2 parents 5c75540 + e764c53 commit c588702

File tree

7 files changed

+67
-12
lines changed

7 files changed

+67
-12
lines changed

.github/workflows/rust-clippy.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# rust-clippy is a tool that runs a bunch of lints to catch common
6+
# mistakes in your Rust code and help improve your Rust code.
7+
# More details at https://github.com/rust-lang/rust-clippy
8+
# and https://rust-lang.github.io/rust-clippy/
9+
10+
name: rust-clippy analyze
11+
12+
on:
13+
push:
14+
branches: [ "master" ]
15+
pull_request:
16+
# The branches below must be a subset of the branches above
17+
branches: [ "master" ]
18+
schedule:
19+
- cron: '44 13 * * 2'
20+
21+
jobs:
22+
rust-clippy-analyze:
23+
name: Run rust-clippy analyzing
24+
runs-on: ubuntu-latest
25+
permissions:
26+
contents: read
27+
security-events: write
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v2
31+
32+
- name: Install Rust toolchain
33+
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1
34+
with:
35+
profile: minimal
36+
toolchain: stable
37+
components: clippy
38+
override: true
39+
40+
- name: Install required cargo
41+
run: cargo install clippy-sarif sarif-fmt
42+
43+
- name: Run rust-clippy
44+
run:
45+
cargo clippy
46+
--all-features
47+
--message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
48+
continue-on-error: true
49+
50+
- name: Upload analysis results to GitHub
51+
uses: github/codeql-action/upload-sarif@v1
52+
with:
53+
sarif_file: rust-clippy-results.sarif
54+
wait-for-processing: true

Cargo.lock

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

plotters-svg/src/svg.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::fs::File;
1313
use std::io::Cursor;
1414
use std::io::{BufWriter, Error, Write};
1515
use std::path::Path;
16+
use std::fmt::Write as _;
1617

1718
fn make_svg_color(color: BackendColor) -> String {
1819
let (r, g, b) = color.rgb;
@@ -314,7 +315,7 @@ impl<'a> DrawingBackend for SVGBackend<'a> {
314315
(
315316
"points",
316317
&path.into_iter().fold(String::new(), |mut s, (x, y)| {
317-
s.push_str(&format!("{},{} ", x, y));
318+
write!(s, "{},{} ", x, y).ok();
318319
s
319320
}),
320321
),
@@ -340,7 +341,7 @@ impl<'a> DrawingBackend for SVGBackend<'a> {
340341
(
341342
"points",
342343
&path.into_iter().fold(String::new(), |mut s, (x, y)| {
343-
s.push_str(&format!("{},{} ", x, y));
344+
write!(s, "{},{} ", x, y).ok();
344345
s
345346
}),
346347
),

plotters/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ deprecated_items = [] # Keep some of the deprecated items for backward compatibi
106106
itertools = "0.10.0"
107107
criterion = "0.3.4"
108108
rayon = "1.5.1"
109-
serde_json = "1.0.64"
110-
serde = "1.0.126"
111-
serde_derive = "1.0.126"
109+
serde_json = "1.0.82"
110+
serde = "1.0.138"
111+
serde_derive = "1.0.138"
112112

113113
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
114114
rand = "0.8.3"

plotters/src/chart/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl<'a, 'b, DB: DrawingBackend> ChartBuilder<'a, 'b, DB> {
253253
size: S,
254254
) -> &mut Self {
255255
let size = size.in_pixels(self.root_area);
256-
self.label_area_size[pos as usize] = size.abs() as u32;
256+
self.label_area_size[pos as usize] = size.unsigned_abs();
257257
self.overlap_plotting_area[pos as usize] = size < 0;
258258
self
259259
}

plotters/src/chart/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<'a, DB: DrawingBackend, CT: CoordTranslate> ChartContext<'a, DB, CT> {
6868
}
6969
}
7070

71-
impl<'a, 'b, DB, CT> From<&ChartContext<'a, DB, CT>> for ChartState<CT>
71+
impl<'a, DB, CT> From<&ChartContext<'a, DB, CT>> for ChartState<CT>
7272
where
7373
DB: DrawingBackend,
7474
CT: CoordTranslate + Clone,

plotters/src/style/font/font_desc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl<'a> FontDesc<'a> {
154154
pub fn box_size(&self, text: &str) -> FontResult<(u32, u32)> {
155155
let ((min_x, min_y), (max_x, max_y)) = self.layout_box(text)?;
156156
let (w, h) = self.get_transform().transform(max_x - min_x, max_y - min_y);
157-
Ok((w.abs() as u32, h.abs() as u32))
157+
Ok((w.unsigned_abs(), h.unsigned_abs()))
158158
}
159159

160160
/// Actually draws a font with a drawing function

0 commit comments

Comments
 (0)