Skip to content

Commit 9d78367

Browse files
committed
style: format and add vscode/settings.json and rustfmt.toml
1 parent 5b499f5 commit 9d78367

File tree

23 files changed

+243
-103
lines changed

23 files changed

+243
-103
lines changed

.vscode/settings.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"evenBetterToml.formatter.alignComments": true,
3+
"evenBetterToml.formatter.alignEntries": true,
4+
"evenBetterToml.formatter.arrayAutoCollapse": true,
5+
"evenBetterToml.formatter.arrayAutoExpand": true,
6+
"evenBetterToml.formatter.arrayTrailingComma": true,
7+
"evenBetterToml.formatter.trailingNewline": true,
8+
"evenBetterToml.formatter.reorderArrays": true,
9+
"evenBetterToml.formatter.reorderInlineTables": true,
10+
"evenBetterToml.formatter.reorderKeys": true,
11+
"evenBetterToml.rules": [
12+
{
13+
"formatting": {
14+
"reorder_arrays": false,
15+
"reorder_inline_tables": false,
16+
"reorder_keys": false
17+
},
18+
"include": [
19+
"Cargo.toml"
20+
],
21+
"keys": [
22+
"package",
23+
]
24+
}
25+
],
26+
"rust-analyzer.check.command": "clippy",
27+
"rust-analyzer.imports.granularity.enforce": true,
28+
"rust-analyzer.imports.prefix": "crate",
29+
"rust-analyzer.rustfmt.extraArgs": [
30+
"+nightly"
31+
],
32+
}

rustfmt.toml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
array_width = 60
2+
attr_fn_like_width = 70
3+
binop_separator = "Front"
4+
blank_lines_lower_bound = 0
5+
blank_lines_upper_bound = 1
6+
brace_style = "SameLineWhere"
7+
chain_width = 60
8+
color = "Auto"
9+
combine_control_expr = true
10+
comment_width = 80
11+
condense_wildcard_suffixes = false
12+
control_brace_style = "AlwaysSameLine"
13+
disable_all_formatting = false
14+
doc_comment_code_block_width = 100
15+
edition = "2024"
16+
emit_mode = "Files"
17+
empty_item_single_line = true
18+
enum_discrim_align_threshold = 0
19+
error_on_line_overflow = false
20+
error_on_unformatted = false
21+
fn_call_width = 60
22+
fn_params_layout = "Tall"
23+
fn_single_line = false
24+
force_explicit_abi = true
25+
force_multiline_blocks = true
26+
format_code_in_doc_comments = false
27+
format_generated_files = true
28+
format_macro_bodies = true
29+
format_macro_matchers = false
30+
format_strings = false
31+
generated_marker_line_search_limit = 5
32+
group_imports = "StdExternalCrate"
33+
hard_tabs = false
34+
hex_literal_case = "Preserve"
35+
ignore = []
36+
imports_granularity = "Crate"
37+
imports_indent = "Block"
38+
imports_layout = "Mixed"
39+
indent_style = "Block"
40+
inline_attribute_width = 0
41+
make_backup = false
42+
match_arm_blocks = true
43+
match_arm_leading_pipes = "Never"
44+
match_block_trailing_comma = false
45+
max_width = 100
46+
merge_derives = true
47+
newline_style = "Auto"
48+
normalize_comments = false
49+
normalize_doc_attributes = false
50+
overflow_delimited_expr = false
51+
remove_nested_parens = true
52+
reorder_impl_items = true
53+
reorder_imports = true
54+
reorder_modules = true
55+
required_version = "1.8.0"
56+
short_array_element_width_threshold = 10
57+
show_parse_errors = true
58+
single_line_if_else_max_width = 50
59+
single_line_let_else_max_width = 50
60+
skip_children = false
61+
skip_macro_invocations = []
62+
space_after_colon = true
63+
space_before_colon = false
64+
spaces_around_ranges = false
65+
struct_field_align_threshold = 0
66+
struct_lit_single_line = true
67+
struct_lit_width = 18
68+
struct_variant_width = 35
69+
style_edition = "2024"
70+
tab_spaces = 4
71+
trailing_comma = "Vertical"
72+
trailing_semicolon = true
73+
type_punctuation_density = "Wide"
74+
unstable_features = true
75+
use_field_init_shorthand = false
76+
use_small_heuristics = "Default"
77+
use_try_shorthand = false
78+
where_single_line = false
79+
wrap_comments = false

src/capture/canvas.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@ use iced::{
1313
},
1414
};
1515

16-
use super::{
17-
Capture, DrawElement, Message,
18-
draw::{FONT_SIZE_FACTOR, STROKE_WIDHT_FACTOR, Tool},
16+
use crate::{
17+
capture::{
18+
Capture, Message,
19+
draw::{DrawElement, FONT_SIZE_FACTOR, STROKE_WIDHT_FACTOR, Tool},
20+
mode::Mode,
21+
},
22+
consts::MEDIUM_FONT,
23+
theme::Theme,
1924
};
20-
use crate::{capture::mode::Mode, consts::MEDIUM_FONT, theme::Theme};
2125

2226
impl Program<Message, Theme> for Capture {
2327
type State = ();

src/capture/crop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::rc::Rc;
22

33
use iced::Point;
44

5-
use super::CapturedWindow;
5+
use crate::capture::CapturedWindow;
66

77
#[derive(Debug, Default)]
88
pub enum CropState {

src/capture/draw.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ impl Tool {
280280
final_pt.y - size * (rad + std::f32::consts::PI / 5.0).sin(),
281281
);
282282
}
283-
Self::Text { .. } => (),
283+
_ => {}
284284
}
285285
}
286286

src/capture/image.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ use xcap::image::{
1111
imageops::{crop_imm, overlay},
1212
};
1313

14-
use super::{
15-
Capture, DrawElement,
16-
crop::CropState,
17-
draw::{FONT_SIZE_FACTOR, STROKE_WIDHT_FACTOR, Tool},
18-
mode::Mode,
19-
};
2014
use crate::{
15+
capture::{
16+
Capture,
17+
crop::CropState,
18+
draw::{DrawElement, FONT_SIZE_FACTOR, STROKE_WIDHT_FACTOR, Tool},
19+
mode::Mode,
20+
},
2121
config::Config,
2222
consts::{APPNAME, FONT_NAME, MEDIUM_FONT_TTF},
2323
organize_type::OrgranizeMode,

src/capture/init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use anyhow::{Context, Result};
44
use iced::{Point, widget::canvas::Cache};
55
use xcap::Monitor;
66

7-
use super::{Capture, CapturedWindow, mode::Mode};
7+
use crate::capture::{Capture, CapturedWindow, mode::Mode};
88

99
impl Capture {
1010
pub fn new(monitor: Monitor) -> Result<Self> {

src/capture/mode.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ use std::rc::Rc;
22

33
use iced::{Point, Size};
44

5-
use super::{CapturedWindow, DrawElement, crop::CropState, draw::DrawState};
5+
use crate::capture::{
6+
CapturedWindow,
7+
crop::CropState,
8+
draw::{DrawElement, DrawState},
9+
};
610

711
#[derive(Debug)]
812
pub enum Mode {

src/capture/update.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
use iced::{Point, Size, widget::text_input::focus};
22

3-
use super::{Capture, DrawElement, Message, Request, crop::CropState, draw::DrawState, mode::Mode};
4-
use crate::action::Action;
3+
use crate::{
4+
action::Action,
5+
capture::{
6+
Capture, Message, Request,
7+
crop::CropState,
8+
draw::{DrawElement, DrawState},
9+
mode::Mode,
10+
},
11+
};
512

613
impl Capture {
714
pub fn update(&mut self, message: Message) -> Action<Message, Request> {

src/capture/view.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ use iced::{
77
},
88
};
99

10-
use super::{
11-
Capture, Message, Mode,
12-
crop::CropState,
13-
draw::{Tool, ToolColor},
14-
};
1510
use crate::{
11+
capture::{
12+
Capture, Message,
13+
crop::CropState,
14+
draw::{Tool, ToolColor},
15+
mode::Mode,
16+
},
1617
consts::{ICON_FONT, MEDIUM_FONT, MOVE_ICON},
1718
theme::{Element, button::ButtonClass, container::ContainerClass, text::TextClass},
1819
};

0 commit comments

Comments
 (0)