Skip to content

Commit

Permalink
chore: fix clippy warnings, remove license template
Browse files Browse the repository at this point in the history
The license template has been removed from rustfmt nightly :(
  • Loading branch information
lucasfernog committed Jun 25, 2022
1 parent 9d33d09 commit 23a049c
Show file tree
Hide file tree
Showing 33 changed files with 23 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-fmt-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: stable
override: true
components: rustfmt

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-fmt-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: stable
override: true
components: rustfmt

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-bundler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: stable
override: true
components: rustfmt

Expand Down
3 changes: 0 additions & 3 deletions .license_template

This file was deleted.

3 changes: 0 additions & 3 deletions core/tauri-build/.license_template

This file was deleted.

3 changes: 0 additions & 3 deletions core/tauri-codegen/.license_template

This file was deleted.

3 changes: 0 additions & 3 deletions core/tauri-macros/.license_template

This file was deleted.

3 changes: 0 additions & 3 deletions core/tauri-runtime-wry/.license_template

This file was deleted.

8 changes: 4 additions & 4 deletions core/tauri-runtime-wry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ use std::{
};

pub type WebviewId = u64;
type IpcHandler = dyn Fn(&Window, String) + 'static;
type FileDropHandler = dyn Fn(&Window, WryFileDropEvent) -> bool + 'static;

mod webview;
pub use webview::Webview;
Expand Down Expand Up @@ -3067,7 +3069,7 @@ fn create_ipc_handler<T: UserEvent>(
menu_ids: Arc<Mutex<HashMap<MenuHash, MenuId>>>,
js_event_listeners: Arc<Mutex<HashMap<JsEventListenerKey, HashSet<u64>>>>,
handler: WebviewIpcHandler<T, Wry<T>>,
) -> Box<dyn Fn(&Window, String) + 'static> {
) -> Box<IpcHandler> {
Box::new(move |window, request| {
let window_id = context.webview_id_map.get(&window.id());
handler(
Expand All @@ -3086,9 +3088,7 @@ fn create_ipc_handler<T: UserEvent>(
}

/// Create a wry file drop handler.
fn create_file_drop_handler<T: UserEvent>(
context: &Context<T>,
) -> Box<dyn Fn(&Window, WryFileDropEvent) -> bool + 'static> {
fn create_file_drop_handler<T: UserEvent>(context: &Context<T>) -> Box<FileDropHandler> {
let window_event_listeners = context.window_event_listeners.clone();
let webview_id_map = context.webview_id_map.clone();
Box::new(move |window, event| {
Expand Down
3 changes: 0 additions & 3 deletions core/tauri-runtime/.license_template

This file was deleted.

3 changes: 0 additions & 3 deletions core/tauri-utils/.license_template

This file was deleted.

3 changes: 0 additions & 3 deletions core/tauri/.license_template

This file was deleted.

13 changes: 6 additions & 7 deletions core/tauri/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use tauri_utils::{
html::{SCRIPT_NONCE_TOKEN, STYLE_NONCE_TOKEN},
};

use crate::app::{GlobalMenuEventListener, WindowMenuEvent};
use crate::hooks::IpcJavascript;
#[cfg(feature = "isolation")]
use crate::hooks::IsolationJavascript;
Expand All @@ -51,6 +50,10 @@ use crate::{
Context, EventLoopMessage, Icon, Invoke, Manager, Pattern, Runtime, Scopes, StateManager, Window,
WindowEvent,
};
use crate::{
app::{GlobalMenuEventListener, WindowMenuEvent},
window::WebResourceRequestHandler,
};

#[cfg(any(target_os = "linux", target_os = "windows"))]
use crate::api::path::{resolve_path, BaseDirectory};
Expand Down Expand Up @@ -390,9 +393,7 @@ impl<R: Runtime> WindowManager<R> {
label: &str,
window_labels: &[String],
app_handle: AppHandle<R>,
web_resource_request_handler: Option<
Box<dyn Fn(&HttpRequest, &mut HttpResponse) + Send + Sync>,
>,
web_resource_request_handler: Option<Box<WebResourceRequestHandler>>,
) -> crate::Result<PendingWindow<EventLoopMessage, R>> {
let is_init_global = self.inner.config.build.with_global_tauri;
let plugin_init = self
Expand Down Expand Up @@ -1045,9 +1046,7 @@ impl<R: Runtime> WindowManager<R> {
app_handle: AppHandle<R>,
mut pending: PendingWindow<EventLoopMessage, R>,
window_labels: &[String],
web_resource_request_handler: Option<
Box<dyn Fn(&HttpRequest, &mut HttpResponse) + Send + Sync>,
>,
web_resource_request_handler: Option<Box<WebResourceRequestHandler>>,
) -> crate::Result<PendingWindow<EventLoopMessage, R>> {
if self.windows_lock().contains_key(&pending.label) {
return Err(crate::Error::WindowLabelAlreadyExists(pending.label));
Expand Down
4 changes: 3 additions & 1 deletion core/tauri/src/updater/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ use std::{
process::{exit, Command},
};

type ShouldInstall = dyn FnOnce(&Version, &RemoteRelease) -> bool + Send;

#[derive(Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum RemoteReleaseInner {
Expand Down Expand Up @@ -209,7 +211,7 @@ pub struct UpdateBuilder<R: Runtime> {
pub target: Option<String>,
/// The current executable path. Default is automatically extracted.
pub executable_path: Option<PathBuf>,
should_install: Option<Box<dyn FnOnce(&Version, &RemoteRelease) -> bool + Send>>,
should_install: Option<Box<ShouldInstall>>,
timeout: Option<Duration>,
headers: HeaderMap,
}
Expand Down
4 changes: 3 additions & 1 deletion core/tauri/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ use std::{
sync::Arc,
};

pub(crate) type WebResourceRequestHandler = dyn Fn(&HttpRequest, &mut HttpResponse) + Send + Sync;

#[derive(Clone, Serialize)]
struct WindowCreatedEvent {
label: String,
Expand Down Expand Up @@ -103,7 +105,7 @@ pub struct WindowBuilder<'a, R: Runtime> {
label: String,
pub(crate) window_builder: <R::Dispatcher as Dispatch<EventLoopMessage>>::WindowBuilder,
pub(crate) webview_attributes: WebviewAttributes,
web_resource_request_handler: Option<Box<dyn Fn(&HttpRequest, &mut HttpResponse) + Send + Sync>>,
web_resource_request_handler: Option<Box<WebResourceRequestHandler>>,
}

impl<'a, R: Runtime> fmt::Debug for WindowBuilder<'a, R> {
Expand Down
1 change: 0 additions & 1 deletion core/tests/restart/.license_template

This file was deleted.

3 changes: 0 additions & 3 deletions examples/api/src-tauri/.license_template

This file was deleted.

3 changes: 0 additions & 3 deletions examples/resources/src-tauri/.license_template

This file was deleted.

3 changes: 0 additions & 3 deletions examples/sidecar/src-tauri/.license_template

This file was deleted.

3 changes: 0 additions & 3 deletions examples/tauri-dynamic-lib/src-app1/.license_template

This file was deleted.

3 changes: 0 additions & 3 deletions examples/tauri-dynamic-lib/src-tauri/.license_template

This file was deleted.

3 changes: 0 additions & 3 deletions examples/updater/src-tauri/.license_template

This file was deleted.

1 change: 0 additions & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ force_explicit_abi = true
# normalize_comments = true
normalize_doc_attributes = true
# wrap_comments = true
license_template_path = ".license_template"
3 changes: 0 additions & 3 deletions tooling/bench/tests/cpu_intensive/src-tauri/.license_template

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions tooling/bench/tests/helloworld/src-tauri/.license_template

This file was deleted.

3 changes: 0 additions & 3 deletions tooling/bundler/.license_template

This file was deleted.

3 changes: 0 additions & 3 deletions tooling/cli/.license_template

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Install rustfmt with nightly toolchain
- name: Install rustfmt with stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: stable
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
Expand Down
1 change: 0 additions & 1 deletion tooling/cli/templates/plugin/backend/.license_template

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Install rustfmt with nightly toolchain
- name: Install rustfmt with stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
toolchain: stable
override: true
components: rustfmt
- uses: actions-rs/cargo@v1
Expand Down
1 change: 0 additions & 1 deletion tooling/cli/templates/plugin/with-api/.license_template

This file was deleted.

3 changes: 0 additions & 3 deletions tooling/webdriver/.license_template

This file was deleted.

0 comments on commit 23a049c

Please sign in to comment.